Failing to adhere to HOA rules (which may not be readily apparent) results in fines and conflict with a group that's empowered to make decisions about your property. When homeowners have these decisions taken away and are forced to shell out, it becomes a financial and psychological strain that prompts people who would otherwise be enjoying the property to leave (or to not purchase it in the first place).
My neighborhood has an HOA. I'm not allowed to use a grill on my deck. I can't just leave piles of trash in my yard. I can't install a garbage disposal unit in my sink. There are rules and the kind I would have really rolled my eyes at when I was younger.
But these rules, the HOA, they are required by state and federal law: https://www.hopb.co/new-hampshire
Condos are "common interest living spaces", if someone's house caught fire it can spread to the others. If the septic tank gets screwed up we all need to contribute to get that fixed. There are certain liabilities involved here that require some kind of legal entity to adjudicate, this is the role our HOA fills.
While I don't have the numbers, I speculate that the majority of HOAs in the United States were likely created for similar reasons. Fundamentally an HOA is kind of like the residential version of a workers cooperative, they enable high density housing where everyone gets to have equity. Living under an HOA will always be better than living under a landlord, yet I feel few make this connection, especially when considering who is more likely to discriminate.
It’s almost always just related to standards of appearance. Landscaping, building modifications, having junk laying around, etc.
But garbage pickup was as far as I know managed by the county.
My HOA does. It mows lawns and removes snow. That's almost it: the rules are largely about not storing explosives in your house, which is apparently a thing in Wyoming.
Let me tell you about mine. Apart from snow removal and mowing the common lands, we handle curbside trash collection, repairs to water mains, flushing hydrants, maintaining streetlights (and paying for the electricity to light them), capital projects to manage stormwater, paving, sewer maintenance, installing fiber, forest management, etc. We also negotiate group rates for utilities like gas and electricity. A recent major project is replacing the pumps in our sewer lift station to the tune of $17k (an expense we budgeted for, thankfully). So yeah, apart from things like education and emergency services, we are basically a 19 house municipality.