Many companies featured on Money advertise with us. Opinions are our own, but compensation and
in-depth research may determine where and how companies appear. Learn more about how we make money.

Mark Coffey—Getty Images

It's no secret middle-class earners are finding it hard to afford homes in big cities. A new study suggests it's not just the so-called creative class that's getting priced out. Paychecks for teachers, cops, and firefighters are also proving inadequate, suggesting these public servants may be struggling to live in the communities they serve.

A decade after the housing crisis, national home prices have finally returned to a pre-crisis peak, with the biggest gains in fashionable, tech-savvy cities where young workers -- and often their parents -- have flocked. It's not just New York and San Francisco, though. Home prices in places like Denver (up 9% over the past year), Nashville (up 14%), and Dallas (up 16%) have also been booming. The dynamic has helped pushed the national homeownership rate down to a level not seen since the 1960s.

Much of the media angst has centered on millennials' inability to buy homes. But it's a problem that affects many middle-class Americans, making home ownership a struggle -- particularly for single-earner households, according to new research from real estate website Trulia.

In examining home affordability by occupation, Trulia compared local home prices to median incomes for doctors, teachers, first responders, and restaurant workers in the U.S.'s 93 largest metro areas. Trulia then calculated what share of the city's housing stock a typical professional could afford, if putting 20% down and paying 4.1% interest on a 30-year mortgage. The analysis assumed these workers would devote 31% of their income to housing -- in line with federal guidelines for what is considered "affordable."

The upshot: Ridiculous cities like San Francisco -- with a median list price of $1.249 million -- were way out of range for the middle-class earners like teachers, police and firefighters. First responders could afford just 2% of the houses there, and teachers less than 0.4%.

But many other cities also posed problems. First responders, for instance, could afford less than 20% of homes in Raleigh, N.C. and Madison, Wis., and only about one-fourth in cities including Salt Lake City, Nashville, Austin, Dallas, Orlando, Baton Rouge, and Denver.

In all, doctors could afford 50% or more of the homes in every city except San Francisco. First responders could afford half or more of homes in 43 of the 93 metros in the study; teachers were slightly better off, able to afford the typical home in 46 of the 93. Restaurant workers faced the greatest bind: There was no major metro area studied in which they could afford a majority of the housing stock.

There is one caveat to the data: Trulia based its findings on a single income. When the researchers assumed households had two more or less equal earners -- essentially doubling purchasing power -- both first responders and teachers could afford the average in all but the most expensive cities like San Francisco or Honolulu.