> People just rent flats in the city, go to uni
Stanford is an edge case because, as a sibling commenter says, it owns a lot of real estate, but also it's in an insanely high cost-of-living area, so students can't necessarily afford to live just anywhere. At most "normal" universities in the US, you can just live off-campus and do what you want (or at least, follow the city and landlord's rules, not the university's).
My understanding is that universities in the U.S. often own much of the real estate around their campuses. (This is particularly true at Stanford; even faculty members who want to live nearby end up renting from Stanford or "buying" land leases.)
Why are people over the age of 18 voluntarily putting themselves into an environment where they have to ask if they can have a party? Why is this nonsense not simply dying on its own? The real problem is that people don't simply leave. Easiest way to not be annoyed by some bureaucrat gone mad with power is to separate school life from private life.