The average rate on a 30-year mortgage in the U.S. edged closer to 7% this week, climbing to its highest level since July.

The rate rose to 6.84% from 6.78% last week, mortgage buyer Freddie Mac said Thursday. That’s still down from a year ago, when the rate averaged 7.29%.

Borrowing costs on 15-year fixed-rate mortgages, popular with homeowners seeking to refinance their home loan to a lower rate, also ticked up this week. The average rate rose to 6.02% from 5.99% last week. A year ago, it averaged 6.67%, Freddie Mac said.

When mortgage rates increase they can add hundreds of dollars a month in costs for borrowers, reducing homebuyers’ purchasing power at a time when home prices remain near all-time highs, even though U.S. home sales are on track for their worst year since 1995.

The average rate on a 30-year mortgage fell to a two-year low of 6.08% in late September but it’s been mostly rising since then, echoing moves in the 10-year Treasury yield, which lenders use as a guide to pricing home loans.

The yield, which has mostly hovered around 4.4% since last week and was below 3.70% in September, has been rising in recent weeks following mixed reports on inflation and the economy. It also surged after the presidential election, reflecting expectations among investors that President-elect Donald Trump’s proposed economic policies may widen the federal deficit and crank up inflation.

Mortgage rates slid to just above 6% in September following the Federal Reserve’s decision to cut its main interest rate for the first time in more than four years. While the central bank doesn’t set mortgage rates, its actions and the trajectory of inflation influence the moves in the 10-year Treasury yield. The central bank’s policy pivot is expected to eventually clear a path for mortgage rates to generally go lower. But that could change if the next administration’s policies send inflation into overdrive again.

September’s pullback in mortgage rates helped drive a pickup in sales of previously occupied U.S. homes last month. However, the recent climb in rates has put a damper on the housing market in the near term, said Hannah Jones, senior economic research analyst at Realtor.com.

“Mortgage rates reached the high-6% range in late October, and have remained elevated since, much to the disappointment of buyers hoping to find some relief in the late-fall housing market,” she said.

Forecasting the trajectory of mortgage rates is difficult, given that rates are influenced by many factors, from government spending and the economy, to geopolitical tensions and stock and bond market gyrations.

Economists predict that mortgage rates will remain volatile this year, but generally forecast them to hover around 6% in 2025.