Most of it is via research grants.
My university is a research university and lives on government grants.
It is also a state university, and as such gets state money as well in the form of a 'per head' payment. But that money has gotten smaller and smaller over the past 2 decades, so that student tuition which used to account for less than 1/4 the total cost of an undergraduate degree (with the rest made up for by the state) now accounts for 3/4 of the cost of an undergraduate degree (with the state picking up the last 1/4.)
Major donor grants also account for a significant portion of the budget, but the vast majority is earmarked for new building construction, not scholarships or faculty endowed positions.
Science researchers need new buildings, too!