On the other hand, if you are a foreigner, it's pretty hard to break into the U.S. IT job market. H1Bs are scarce. If you can get accepted into a U.S. PhD program though, you get a well recognized credential, and you get a year of OPT and it's easier to get an H1B after that (or at least it was -- I know a lot of this is changing). You also get six years to improve your English. Even if you return to your home country, the U.S. PhD is likely to open many doors.
What is the population of the world versus the population of the US?
The real reason why the stats are so skewed towards foreigners is that the basic trade of the PhD is a lot more favorable if you don't have the alternative of just taking your bachelor's and going to work in the U.S.
For grad students, the tuition waiver costs the same amount regardless of where the student is from. Assuming you could fill the ranks with (presumably less qualified overall) U.S. students, and the same amount of grant money was available, it doesn't make any difference.
Getting PHD is grueling low paid work with insane hours and very distant payoff. You become phd if you are idealist or have nothing better to do. It is possible that with all of diversity initiatives in big tech some potential phd get siphoned off after college - at least FAANG offer livable wage compared to the 30K phd stipend.
There is infinite number of lines that go through a single data point.