so does this law stop corporations from buiiding housing?
First, there is a difference between building and renting. Builders build and sell - no problem.
It should stop publicly traded corporations from buying housing for the intent of rental income. Individual investors can participate in the creation of new apartments through syndications (basically LLC’s on a single complex where they are an investor). You can do a syndication for building a new complex or buying an old one and fixing it up. Most syndications have an intent to go 3-5 years. After that, they cash out and sell to the next group of investors. Owning apartment complexes is highly illiquid so people want periodic access to their money and they can only do that by selling.