U.S. homebuilders should be feeling pretty good about their business, given the nation's severe shortage of homes for sale, but a sharp spike in the cost of lumber is weighing heavy on their bottom lines.

A monthly index of homebuilder confidence in the single-family market fell 2 points in July to 64 from a downwardly revised June reading. Economists had expected a reading of 68. Anything above 50 is considered positive, but this is the lowest reading on the National Association of Home Builders/Wells Fargo Housing Market Index since November — before the presidential election.

"Our members are telling us they are growing increasingly concerned over rising material prices, particularly lumber," said NAHB Chairman Granger MacDonald, a homebuilder and developer from Kerrville, Texas. "This is hurting housing affordability even as consumer interest in the new-home market remains strong."

Builders were initially euphoric following the November election of President Donald Trump, hoping the new administration would lift some of the heavy regulations that now account for about a quarter of the cost of putting up a new home. Builder confidence jumped 6 points from November to December (63 to 69) and then jumped again to 71 in March, following the administration's repeal of certain environmental regulations specifically involving water.

Now, new tariffs on Canadian lumber of up to 24 percent announced by the Trump administration in May, as well as the expectation of additional tariffs on other homebuilding materials imported from overseas, are overtaking the benefits of deregulation. The cost of framing lumber has spiked in recent months and continues to rise today, which only exacerbates already rising prices for land and skilled labor.

"Builders will need to manage some increasing supply-side costs to keep home prices competitive," said NAHB Chief Economist Robert Dietz.

The median price of a newly built home sold in May rose to a record $345,800, according to the U.S. Census. Homebuilders claim they are shifting focus to cheaper, starter homes, as demand by first-time buyers rises, but construction costs are simply too high to profit in that segment of the market.

"We juggle it," said Stephen Paul, vice president of homebuilding operations at Maryland-based Mid-Atlantic Builders. "It's a challenge if you sell homes under contract months in advance, because you're exposed to those price increases."

Of the index's three components, current sales conditions fell 2 points to 70 and sales expectations over the next six months dropped 2 points to 73. Buyer traffic lost 1 point to 48, the only component in negative territory.

Regionally, on a three-month moving average, builder confidence in the Northeast rose 1 point to 47. The West and Midwest each fell 1 point to 75 and 66, respectively. Sentiment in the South dropped 3 points to 67.