My previous house was in a tiny city (0.9ish square miles) that had no hoa and had some of the absolute best municipal areas, parks, and events of anywhere I have seen. The costs of that were baked into the property taxes paid to the city and they never had any issues. We had code enforcement but they were largely unintrusive.
Where I moved to has good parks but the hoa is mental. I would not have moved out of my old city if the houses were bigger but we just outgrew our house with our kids.
Point is, if you set it up right, the funds are there. If you want to be a shitty city and buck responsibility HOA's allow that, same with MUD's and LID's. Its all privitization of stuff governments are supposed to provide from tax revenue.