As a recovery in the U.S. housing market gains footing, the biggest beneficiaries turn out to be the makers of kitchen cabinets, door locks and bathroom fixtures, not companies that actually build the homes.

Profits have soared at American Woodmark Corp.; Masco Corp., whose brands include Delta faucets and Behr paint; and carpet producer Mohawk Industries Inc. Prices for raw materials, such as copper and nickel, are falling enough to offset higher labor costs while sales are up as builders outfit more homes.

In contrast, D.R. Horton Inc., NVR Inc. and other homebuilders have seen expenses rise as wages grow, and haven't seen the decline in product prices from suppliers.

"Building-product and remodeling companies are attractive ways to tap into the recovery," said Garik Shmois, an analyst with Longbow Research. "They are seeing fast margin expansion due to lower raw material costs while also benefiting from the improved demand."

The companies that feed into the housing industry have been a bright spot on stock indexes dragged down by emerging-market weakness, the impact of lower oil prices on energy profits and the overhang of an anticipated increase in U.S. interest rates.

After holding back since the 2008-09 recession, consumers now feel confident enough in the economy to fix up their homes, Shmois said.

The National Association of Realtors predicts the sale of 5.29 million previously owned homes this year, the most since 2006. Existing home sales are about at their highest levels since 2007, while new home sales are still well below their peak.

The home-improvement recovery has at least two more years to go, Shmois said. That will help drive stocks even after the large gains this year that have pushed their price-to-earnings ratio higher.