Can't you buy from the owner and not sign the contract with the HOA? Presumably the HOA has a contractual grievance with the prior-owner; or are such HOA contracts enshrined in criminal law?
HOA restrictions/membership are part of the deed of the property, so you can only acquire the property subject to those restrictions/that membership.
My guess is that the restriction is already on the existing deed, originating with the first sale from the builder of the community. So it transfers with the property.