Because if it is a public state university then the in-state tuition rates are subsidized by the state. The state legislature can also adjust these rates, set caps or minimums for in-state students, and enforce other rules as they see fit -- they're paying the bills, after all.
> why it does not offer scholarships/grants/discounts uniformly to everyone
My state did offer a grant to everyone -- a small one, but one nonetheless.
Outside of that, why would you offer grants or scholarships to folks who a) aren't eligible, and b) who aren't residents of your state or country? Why would Texas give money to someone who is going to go back to PA, or WA, or China after college? They have subsidized Unis in their state, and if they don't want to go there they can help subsidize the schools in a different state by paying the non-resident rate.
Why would you get access to a scholarship for, say, black students if you're not black?
That out-of-state and international tuition is higher than in-state isn't new, and arguably isn't the issue. The issue is that costs, for all parties, ramping up dramatically while the benefit of the degree (salaries) in the work place are diminishing.