My off the cuff (and thus probably naive) thought would be to charge progressive federal taxes on home ownership which progresses based on the unit count owned by an entity. Whether you're an individual or a corporation: your first house is free (0% federal tax). If you own two houses, you pay 3% on the value (of both houses) every year for the right to own them. Maybe at three houses it's already at 10%, and by the time you get to ~10 houses owned, it caps out at 100% tax on the value every year, making large-scale home investing completely unprofitable. The funds from this new tax could be set aside specifically to fund affordable housing programs of some kind.
Under such a scheme, we'd still have rising prices from true single-owner-occupiers under the existing system, but it would slow down and be less-bubbly, at least in the national average, and builders will eventually build new homes to equilibrium, where regulations allow them to. Some moderately-wealthy people could probably still own a second vacation home, or 2-3 rental properties. Some extremely wealthy people might still own 10+ different homes for personal/family use at exorbitant tax cost, but at least the taxes from such scenarios go towards fixing things.