It only cost them yuan if they exchanged yuan for dollars to buy the treasury bills. This is like when you go to Europe, and you exchange dollars for euros at the airport so you can buy things while you’re there. The shopkeepers don’t care what you paid in dollars to get enough euros to buy their stuff, they just sell you trinkets for euros. On the way home, you might exchange any euros you have left for dollars at the same airport counter. If the rate is less on the way out, oh well, sux to be you, but the shopkeepers selling things in euros still don’t care.
If they bought a trillion dollars in bonds, we will pay them a trillion dollars back. The changing of the yuan doesn’t change our debt, we still pay them the same number of dollars as they lent to us. If the exchange rate is different when China goes to “the airport” to exchange those dollars back into yuan, any difference is not our concern.
However, let’s say that it costs 2 yuan to buy a duck (I’m making this up) when they bought the treasury bond, and on the way back out the yuan has risen in value, it might only cost them 1 yuan to buy a duck with the money we pay them back at cash out time. So it’s not necessarily true that they are losing in absolute value.
Something to keep in mind is this. The value of currency is (usually) tied to demand. One way that the Chinese keep the yuan low, is to keep using them to buy dollars (or bonds). This devalues the yuan when compared to the dollar, and increases the value of the dollar when compared to the yuan. (It’s also why returning Chinese tourists are divested of their dollars in exchange for yuan unless they have a very compelling reason to possess dollars in China, and then China uses those dollars to buy from us.) When the U.S. dollar is the world’s reserve currency, that great demand for the dollar keeps it somewhat artificially high.
So, the answer is “yes and no.” :) Investments are not always guaranteed, but the dollar has been a pretty stable investment for a good long time and continues to remain so. China (and anyone else investing in bonds) ought to know the risks before they buy them.