If there's been one upside to the housing crisis, it's the fact that homes are more affordable now than they were at the height of the bubble. For much of the past few years, in fact, housing affordability has been hovering near historic highs, with nearly three quarters of new and existing home sales falling within grasp of median income households. The question now is whether that's on the verge of changing.

Data released yesterday by the National Association of Home Builders showed that affordability, while still high by historical standards, is on the downturn. As a result of rising home prices together with the recent surge in mortgage rates, an estimated 69.3% of home sales fell within range of the median income household in the second quarter of the year. This is down from 73.7% during the first quarter.

"Together with rising mortgage rates, this contributed to affordability slipping to the lowest level in more than four years," observed NAHB Chief Economist David Crowe. "Such movement would be less concerning were it not for ongoing discussions regarding potential changes to the mortgage interest deduction and federal support for the secondary mortgage market, both of which play enormous roles in keeping homeownership affordable."

The range of affordability varies significantly across the country. The most affordable major housing market was the Ogden-Clearfield metropolitan area outside of Salt Lake City, Utah, where 92.8% of homes sold during the second quarter were affordable to families that earned the area's median income. Alternatively, though not surprisingly, the area encompassing San Francisco was the least affordable market, in which only 19.3% of homes sales fell within range of median-income households.

This news, as well as a fall in demand for mortgage applications, is weighing on home builders today. Shares of Toll Brothers (TOL -0.69%) are trading lower by 1.2%, and KB Homes (KBH -1.25%) by 0.65%. Bucking the trend, meanwhile, are shares of Beazer Homes (BZH -2.40%) and Hovnanian (HOV -1.02%), which are up by 0.2% and 1.25%, respectively, at the time of writing.