The major cities of the world have attracted a flurry of interest from out-of-town (OOT) home buyers. Such capital inflows in local real estate have implications for affordability through their effects on prices and rents, but also for construction, local labor markets, the spatial distribution of residents, and ultimately economic welfare. We develop a spatial equilibrium model of a city that features heterogeneous households that make optimal decisions on consumption, savings, labor supply, tenure status, and location. The model generates realistic wealth accumulation and home ownership patterns over the life-cycle and in the cross-section. An inflow of OOT real estate buyers pushes up prices, rents, and wages. It increases the concentration of young, high-productivity, and wealthy households in the city center (gentrification). When OOT investors buy 10% of the housing stock, city welfare goes down by 0.3% of permanent consumption levels. The average renter suffers a large welfare loss while the average owner gains modestly. We adapt the model to the New York metro area, obtain detailed data on OOT purchases, and find that the observed increase in OOT purchases is associated with a 0.1% welfare loss.