Please elaborate on how they keep "undesirable" people out - a statement like this has no meaning without any evidence. The HOA is not involved in the purchase of a house in any way.
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.