Unfortunately in my experience it's the exact opposite. Here they're used and abused by exclusively rich, mostly-white neighborhoods to keep them that way.
I've lived in both HOA and non-HOA neighborhoods. If there's a barrier to entry such as price, then generally a more successful (and hopefully more refined) type of person will move in, and generally the homes will stay nice-looking without rules. Without that, then an HOA to try to maintain an aesthetic baseline can be very helpful. All the homeowners benefit from maintaining an attractive neighborhood, in that their home values will be higher.
If the HOA don’t like you, it seems there little recourse.
In the 70s (I think) and before, HOA were definitely active gatekeepers though against PoC, and then after that with new laws passed, moved to these more "subtle" methods.
However the supreme court also ruled that was unenforceable too.
But that didn't happen before developers realized that they could use HOA's as a cash cow. You sell a house once. But you can collect HOA dues for a couple of decades after. There is a case in Daily City where it took decades for home owners to get rid of the HOA. That collected dues and provided absolutely nothing in return.