Originally? More than just HOA bylaws: HOA’s originally were implemented as part of a belt-and-suspenders approach along with racial covenants—particularly in building out suburban developments—in part in anticipation that the racial restrictions might later be struck down (as they were. In 1948); the HOAs would allow the white majority (guaranteed initially by the racial covenants, and even without active enforcement likely to be maintained by economic inequality for long after that) to drive out non-white residents through selective enforcement of facially race-neutral rules. And, while it is still not always easy to prove, for twenty years after explicit racial covenants attached to property were ruled illegal, other private discrimination related to housing was not, so there wasn't even a legal basis to challenge this.