Recently, the Brazilian bond market had its strongest week ever, attracting close to $6 billion in foreign capital, adding to the more than $20 billion Brazilian companies such as Vale (NYSE: VALE), Banco Bradesco (NYSE: BBD), and Tele Norte (NYSE: TNE) had already raised this year. Meanwhile, Brazilian oil company Petrobras (NYSE: PBR) is preparing to offer $32 billion worth of new shares in the largest global share sale ever. This may sound like great news for Brazil, that it can attract so much foreign investment, especially as it gears up to host the World Cup in 2014 and the Olympics in 2016, both very capital-intensive events. But it's actually a real problem. Or rather, I should say it's a "real" problem, which is the name of Brazil's currency.

You may have heard politicians lately accusing China of keeping its currency, the yuan, artificially low. This makes China's exports cheaper to countries with stronger currencies like the dollar or the euro. Conversely, if China let the yuan appreciate, its goods would become more expensive and importing nations like the U.S. would presumably take their business elsewhere.

This is the problem Brazil is facing. All this foreign investment is collectively like an investment in the country itself, with the real acting like Brazil's ticker. It has a mostly export-oriented economy, selling things like iron ore, soybeans, and coffee to the rest of the world, and with the real up 5% over the last year, the government has been scrambling to buy dollars to keep up with inflows so its exports will remain attractive. The government has even been considering a tax on foreign investment to discourage inflows for the time being.

The problem extends beyond Brazil, though. The country is among the chief exporters for some important commodities, such as sugar, cocoa, and coffee. As its currency increases in value, companies that rely on these commodities will find their margins squeezed, and may be forced to pass the costs on to customers. Already, Kraft Foods (NYSE: KFT) and the J.M. Smucker Co. (NYSE: SJM) have increased prices on their bagged coffees, including brands such as Maxwell House, Yuban, and Folgers.

As Brazil moves toward the World Cup and the Olympics, it can expect to see even more foreign investment. This is likely to push the dollar value of Brazilian stocks higher, even if their real value remains unchanged. It will be important for investors to keep currency appreciation in mind as they look at valuations, and consider what impact it may even have on their other commodity-based stocks.

For more Foolishness: