Financed by trade surpluses with the US and other developed nations over the past few decades. Not to mention untold amounts of reverse engineered technology and technology stolen by various other means.
Years ago I worked temporary for a short time at a company that had R&D facilities in China. They had many precautions to keep someone like me from stealing their trade secrets. I recall the irony thinking that their secrets were probably already for sale by corrupt Chinese officials.