Consequently, they balance the books by taking on more foreign/out-of-state students (who they can charge much more).
At the core, though, it appears to be a supply and demand problem: there's a ton of demand for people who want to go to college, colleges don't have the resources (or interest?) to expand supply, and so they raise prices because they can.
With government funding, it's use-it-or-lose-it. I.e. state legislature will definitely allocate it to something else next year, if they come in under-budget in a year.
Add on top of that that state schools have the NASA problem: they're effectively performing (to state legislature and donors) for their dinner. And big, splashy buildings (with dedication names!) impress both. And attract picky faculty and students.
With not-for-profit, facilities are one of the few allowed places you can dump excess cash.
I floated in another comment that government grant/loan programs should impose an ACA-style admin vs teaching cost cap on institutions for participation. Maybe for capex too?
The real problem though are the ridiculous cost of state run schools.
As someone who has been out of college for 20 years, I can't believe what my state school charges now.
When I graduated my school was a good value compared to private options. That was the whole point of a state school.
Now the same school cost 4X what it does and I don't know if I could even get in when up against so many brilliant Indian and Chinese students. I assumed when I went the goal of the institution was for a more educated population in the state. That was the point of the huge difference in price for instate tuition.
Now it seems like some kind of money making racket.