Stung by a median income that ranks dead last among the nation's 25 largest metropolitan areas, middle-class families in Tampa Bay are unable to afford median-priced homes, according to a new study by financial adviser website interest.com.

Tampa Bay's median income this year is $45,880 — a full $4,000 less than the second-worst city, Miami, and nearly half as much as the highest-income city, Washington, D.C.

Home affordability isn't the problem. In fact, Tampa Bay's median home price of $156,000 is fourth most affordable among the biggest 25 cities. Only Pittsburgh, Detroit and St. Louis are more affordable.

But that median income figure is a major drag for Tampa Bay and leaves middle class families with incomes 3 percent short of the money needed to buy even the most average of homes. (The 3 percent shortfall is a slight improvement from last year, but still not much to brag about).

The study comes on the heels of another sobering lookat the state and local economy by the United Way, which found that nearly half of Florida households — 3.2 million in the state, about 600,000 in Tampa Bay — struggle to afford basic needs.

Tampa Bay actually ranks 13th in affordability on the interest.com list of 25 cities.

San Francisco is the least affordable city, with a median home price of $769,600. That's a jaw-dropping $265,000 more than the second-highest city, San Diego, where a median-priced home costs $504,200.

Minneapolis was judged the most affordable city. It enjoys a median income that is $15,000 higher than the national average and also boasts affordable housing. Middle-class families in that city make 23 percent more than the median home price. Atlanta was No. 2 on the affordability list, St. Louis third.

The most affordable metro areas*

1. Minneapolis (+23 percent)

2. Atlanta (+22 percent)

3. St. Louis (+20 percent)

4. Detroit (+14 percent)

5. Pittsburgh (+13 percent)

The least affordable metro areas*

21. Miami (-26 percent)

22. Los Angeles (-32 percent)

23. New York (-32 percent)

24. San Diego (-38 percent)

25. San Francisco (-46 percent)

*Percentages reflect how much the median income exceeds or falls short of the income needed to buy a median-priced home in that metro area.

Lowest-income metros

1. Tampa, $45,880

2. Miami, $49,946

3. Pittsburgh, $51,291

4. San Antonio, $51,716

5. Phoenix, $51,847

Highest-income metros

1. Washington, D.C., $90,149

2. San Francisco, $79,624

3. Boston, $72,907

4. Baltimore, $68,455

5. Seattle, $67,479

Lowest home prices

1. Pittsburgh, $143,690

2. Detroit, $149,000

3. St. Louis, $140,900

4. Tampa, $156,000

5. Atlanta, $166,200

Highest home prices

1. San Francisco, $769,600

2. San Diego, $504,200

3. Los Angeles, $420,300

4. Washington, D.C., $403,600

5. Boston, $398,100