“Why do these places have such huge endowment funds?”
The money comes from alumni donations and foundations, among other sources - the institutions don’t pay taxes on the capital or it’s earnings, which can be used to supplement the operating budget or for emergencies. It’s also a way they keep score (Harvard’s endowment is some $53 billion).
Those with more $500,000 in assets per student are subject to a 1.4 percent tax on net investment income.
Yes, right now it's a pittance, but 1) inflation will inexorably make more and more universities subject to the tax; and 2) Congress will likely (hopefully) increase the tax, like it does every other tax.