For China, subsidizing solar is good investment for their future..
Because otherwise they have to buy oil and other energy resources. That's money that goes out of the country. For US, it is not a big deal as Fed keeps printing dollars like there is no tomorrow, so they have unlimites supply of dollars. Also more importatntly oil trade creates demand for dollar in world markets. Otherwise crash of the dollar will come sooner.