Anger at who is causing that harm can stray uncomfortably close to xenophobia. But politicians and anxious residents often add that their real grievance is with foreign money, not foreigners. And maintaining that distinction is important if cities that have long prided themselves on being cosmopolitan want to continue embracing immigration while curbing speculation.

Setting aside the risks of money-laundering and tax evasion, a big influx of foreign capital poses two potential threats to a local housing market.

First, house prices rise faster than wages, until a good job no longer pays for access to nearby housing. Suddenly nurses and teachers find themselves living in a community that they can no longer afford. As the housing and labor markets become detached, a city can start to look like Vancouver, which has some of the highest housing prices, but lowest incomes, among Canadian metropolitan areas.

The second threat aggravates the first: If foreign buyers are looking for assets and not residences, a lot of that housing may sit empty. Neighborhoods begin to lose their neighbors, and local restaurants and shops lose their customer base, an eerie scene some corners of London have experienced.

Across an entire city, those costs outweigh the benefits of foreign investment, according to two finance professors, Jack Favilukis of the University of British Columbia and Stijn Van Nieuwerburgh of New York University. They modeled what happens when a market like New York City is shocked by an inflow of absentee out-of-town buyers.

Data they obtained from CoreLogic shows that the share of home purchases made by out-of-town buyers has increased steadily since 2004 in both metropolitan New York and Manhattan. More than one in 10 purchases in Manhattan now includes such a buyer (the “out-of-town” definition here doesn’t distinguish between domestic investors and Russian oligarchs, but the effects are the same in the modeling, and the authors think of the problem as one of foreign money).

When they assume a worst-case scenario — all of these out-of-town purchases sit vacant — rents and home prices in the city rise, wages tick up thanks to new construction jobs, commute times for workers grow longer, and center city neighborhoods become less diverse as the wealthy move in. All else equal, they conclude, the rise in out-of-town buyers from levels seen a decade ago pushes home prices up in New York by about 1.1 percent. That may not sound like a lot, but the net effect is a negative one for the city’s welfare, the researchers conclude.