One is seldom given access to HOA bylaws and other deed restrictions until closing, at which point the buyer stands to lose their earnest money.
In some places earnest money is a token couple hundred dollars (we put 500 down in earnest on our current home), and the real estate agent produces a boilerplate contract to which you'll add your own clauses such as "acceptable inspection results". On my last home, I added "acceptable HOA rules and deed restrictions," and made the seller's agent produce them. She wasn't happy; it was an irregular request; but she understood that once agreed to, if they produced them at closing, I was going to spend my time reading them, and be withing my rights to walk away if they were disagreeable.
I wanted to be sure the HOA didn't have any super nutty rules. They didn't - we bought the house.
But in other places where real estate is a bit more competitive (e.g. Westchester County, NY), your earnest deposit might be the 20% that will become your down payment. In those places one hires a real estate lawyer to handle the transaction details. I was pleased with the service mine provided for a mere $600.