What prevents a government from issuing debt to finance riskier investments? Germany has a 10Y bond yield of -0.336%. Meanwhile, Brazil has a 10Y bond yield of 6.415%. 

Why doesn't the German government issue bonds in order to buy Brazilian bonds? It seems a no-brainer win. Actually, the German government could also issue bonds to invest in the stock market. Sure, there is a risk involved, but on average seems a winner.
Here are some hand-wavy arguments to suggest that the "no-arbitrage" rule applies here:


Bond-buying at the scale that nation-states would do it would drive up prices.  So you'd see yields on Brazilian bonds fall even if coupon rates don't move.
Germany would have to finance such a play by issuing yet more bonds, which would drive German bond prices down and therefore German bond yields up even if coupon rates don't move.
Credit markets would likely punish Germany for taking that kind of risk, pushing German bond yields up further because coupon rates would rise.
Ironically, the piling-in of high-quality foreign money into Brazil could serve to stabilize it, which would again lower Brazilian yields because coupon rates would fall.
and 6. Movement in foreign exchange markets that would further close the gap. (credit to @Gio in a comment above).


The net effect: the arbitrage opportunity you've spotted would quickly vanish.  In essence, your plan would amount to Germany volunteering to prop up the Brazilian economy in exchange for being made worse-off.