HSH.com asked the question: How much money does one need to earn to afford a median-priced home in 27 major metro areas?

Based on data compiled by HSH—a mortgage data researcher that has been tracking mortgage rates for more than 30 years—Pittsburgh took the the top spot as the most affordable city in which to buy a home?

In Pittsburgh, you need a salary of $31,716 to buy a median-priced home worth $135,000, according to HSH calculations. The monthly mortgage payment (on a 30-year note) would be $740.

How did they get that?  “To find out, HSH.com took the National Association of Realtors’ fourth-quarter data for median-home prices and HSH.com’s fourth-quarter average interest rate for 30-year, fixed-rate mortgages to determine how much of your salary it would take to afford the base cost of owning a home — the principal, interest, taxes and insurance — in 27 metro areas.

We used standard 28 percent “front-end” debt ratios and a 20 percent down payment subtracted from the NAR’s median-home-price data to arrive at our figures. We’ve incorporated available information on property taxes and homeowner’s insurance costs to more accurately reflect the income needed in a given market. Read more about the methodology and inputs on the final slide of this slideshow.”

While Pittsburgh ranks at the top, on the opposite end of the spectrum, ranking 27th, is San Francisco. To afford the Golden Gate City, you need to take in $142,448 a year to live in a median-priced home of $742,900. The median mortgage payment would set you back $3,323 a month.

“Places like San Francisco can be hard for young people—they’ll be living in a tiny space or will need to have roommates to live in a house,” says Kyra Straussman, director of real estate at the Urban Redevelopment Authority (URA), “but in Pittsburgh people in their mid-20s can afford to buy a big home from an incredible array of housing stock.”

One of the reasons, says Straussman, is that “in the top five cities, more than 65% of the housing stock came before 1970.

“Labor is a sunk cost,” she says. “If you build the same houses today—with the same level of architecture, engineering and craftsmanship—it would be cost-prohibitive in many cases.”

Also in the top 10 most affordable cities: Cleveland, St. Louis, Cincinnati, Detroit, Atlanta, Tampa, Phoenix, Orlando and San Antonio. Check the full list here.

The highest-priced homes were in: San Francisco, San Diego, Los Angeles, New York, Boston, Washington, D.C., Seattle, Denver and Portland.

Pittsburgh was one of only two cities on the list to have a 30-year fixed mortgage rate lower than 4%. We slid in at 3.98% (alongside Washington, D.C). Sacramento had the highest rate at 4.19%, followed by Detroit at 4.18%.

“One of the things about Pittsburgh is that for a young person starting out, it’s an easy place to land,” says Straussman. “Pittsburgh has great housing, it’s a big city with big city amenities—but you don’t have to endure long commutes.

“Young people today are doing something that’s not been done before: they’re ‘city shopping,’” she says. “Pittsburgh is gorgeous, it’s on the river, it doesn’t break the bank—it’s going to make a city shopper put it on their list.”

Woods wanderer who was an an editor at New England’s regional magazine, the research director of a Colorado newspaper and a farm hand in Vermont before returning to Pittsburgh to write about and explore her hometown.