When grants are revoked for political reasons, it affects individuals who happen to be affiliated with the university more than the university itself. And it particularly affects people doing STEM research, because humanities and social sciences receive much less external funding. If the decline in public funding is permanent, it makes humanities and social sciences relatively stronger within the university. They are more viable without public subsidies than the more expensive STEM fields.
In other words, the university may have some property rights to your work if you deal too closely with for-profit businesses or national security interests. But if you are just doing normal research with normal grants, you'll probably never see those exceptions in your career.
You couldn't replace that with a private company "buying" research and expect the same societal benefits.