Profits matter, though! We need them to pay people to do the research and development, which people will not do for nothing - our dependence on food and shelter makes this necessary. If an American firm absorbs all the costs, but gains none of the benefit, it will not survive as long, meaning the research will also disappear alongside it.
China, on the other hand, can spend those funds elsewhere while also poaching the work of the American firm, which would put them at a great competitive advantage.