Fundamentally, if people outside the country want to buy our housing, we should be happy about that, and create jobs by building housing to meet the demand. Imagine if our reaction to Chinese demand for Buicks was to limit car manufacturing and complain that foreign investors are making Buicks unaffordable.
If we could prevent them from getting a visa to come at all, we could do the same thing and we wouldn't even have to build the building. Just allocate a few address numbers on ritzy street corners and sell the "buildings" to investors stashing Russian or Chinese black market cash.
Heck, we could do high-frequency house trading!
More realistically, investors rent out the properties they buy. So a market with tons of foreign investors spending irrationally would have an undersupply of homes to buy and corresponding oversupply of homes for rent. Renters would get a great deal and buyers would get bad ROI.