Well, usually. You can still be subject to HOA restrictions if you agree to them by buying a house in a HOA. You'll also be subject to township/borough restrictions which you can't really opt out of short of excluding entire neighborhoods from your home search (and researching local ordinances beforehand).