There is jackass. There are different Visa programs: O-1 and EB-1. How the fuck did the US government spend $500,000 on your education? Unless you are talking about research grants, in which case they would be available to other researchers, not just you. Move along troll.
O-1 is an extremely hard category to get a visa under. EB-1 is not a visa, it is a permanent residence stream (which is what my employer can file for my green card under, IF they choose). Again, EB-1 is extremely hard to get a green card under - it is for exceptional researchers who are presented as such valuable resources that the country would suffer a significant loss if they weren't allowed to remain (hint, most Ph.D. holders are not, despite what their lawyers might argue).
As for who was eligible for the money - yes, the money was available to my advisor to spend on anyone he chose. He chose to spend it on me because he felt my contributions were valuable. The fact that it could have potentially gone to someone else: why is that relevant?
And how did they spent nearly half a million on me? I got a stipend, a tuition waiver, health insurance, travel reimbursement, the occasional computers/software, and full pay in summers for 6 years. So that is nearly $50,000 per year (I was in an expensive state, my initial stipend was over $2k a month) that is shown to the funding agency (NSF). On top of that, there is a university overhead: For every $1 my advisor could spend, the funding agency would have to give $1.5-$1.75, while the university skimmed off the top. That adds up fast, and I rounded up.