Stories about how unaffordable San Francisco has become are virtually inescapable, and it may seem like fewer and fewer people are willing to try their luck in the Bay Area. But it turns out the people who do end up moving to San Francisco are earning a higher income than ever before.

New research from construction data and analytics company BuildZoom tracks how the median income of residents entering and leaving San Francisco has changed over the past 12 years through annual surveys conducted by the company. BuildZoom’s chief economist, Issi Romem, found that people who are choosing to leave the city are, unsurprisingly, making less than the median income when they decide to leave. But he also found that, starting around 2010, the median income of newcomers to the city increased dramatically. From 2014 to 2016, the average income of new residents surpassed, or was nearly on par with, the median income for all residents.

While there are a few other metropolitan areas where the median income of “in-migrants” is higher than that of “out-migrants” (Los Angeles, Seattle, and San Diego), San Francisco has the largest disparity between the two groups.

According to a blog post from Romem, there are a couple of takeaways here. First, while it may seem promising that people who are moving to the Bay Area are earning more than ever before, the other implication is that only high earners can afford to move to San Francisco. And people who are moving to the city are likely moving to take a job in one of the highest-paying sectors (like tech). Additionally, though the median income is rising, so is the cost of housing. The median price of a home in San Francisco has risen from $543,059 in 2012 to $1.4 million this year, which means that these high earners aren’t necessarily taking home more money.

And for many of those who end up leaving San Francisco, the grass does end up being greener somewhere else. BuildZoom’s analysis found that in 2016, the median household income for out-migrants went from $81,500 once they left the Bay Area to $68,200 in their new city. That’s higher than the median income in many other major U.S. metropolitan areas, including Chicago ($65,500), Portland ($64,900), Los Angeles ($64,700), Dallas ($62,500), and Atlanta ($61,100).