Some do have use, if they are constructed carefully at the beginning.
For example, a coworker lives out in a rural area, on a 7 acre lot, surrounded by other 7 to 10 acre lots. The "road" through the "neighborhood" - a big U shape connecting to the same 2 lane county road at both ends - was hard packed lime stone.
The HOA was formed and its sole purpose is to collect $50 per month to pay to have the road re-graded every year with the extra going into an account to have the road paved "for real" at some point in the future.
But yeah, I agree, the behavior that "most" HOA horror stories depict needs to be made illegal.