Reasonable question.

It depends, at top level, what the intention is. What the US government thinks it is buying. Is it buying global improvement in research? If so, surely you just hire smartest people out there. In fact it will probably be mostly non-Americans, because even if they come from a much-better-than-average educational system, still, they are something like 4% of global population.

Ok, so let's say not this. Perhaps US govt is strictly buying (indirect) improvement to US economy. Well, a lot of these students will stay in the US, find startups, or simply become good taxpayers. Most developed countries struggle to grow or keep their societies steady, US has this funnel of highly skilled workforce - universities. Even better, since these immigrants, if they stay, won't have generated primary education costs, and if they eventually leave, also will cost less in adult life than people who stay in the US all their life.

This is about undergrads, really. Postgraduate students are more like hard, underpaid jobs. People come and go, and perform the service of churning out research for an American University.

Finally, not sure how much the US govt is paying for these foreign undergrads. Rich undergrads will have to lay a good chunk of their own fees - perhaps all, either via cash or loans they have to repay.

I'm not in any way endorsing this kerfuffle, but it's always good to be clear why you are paying for things, as sooner or later someone will challenge it.