SEC Sues Former Freddie Mac And Fannie Mae CEO's Over Subprime Loan Disclosures Photo by Win McNamee/Getty Images

The average contract rate for a 30-year mortgage climbed to just under 7% this week, the first time it increased since late May.

The average rate on a 30-year mortgage rose to 6.95% in the week ending July 3. That is 0.09% higher than last week's rate and 0.14% more than the rate from a year prior, according to Freddie Mac's Primary Mortgage Market Survey. The recent uptick follows a four-week decline in the contract rate. 

In addition, borrowing costs on 15-year mortgages also rose this week as the average rate increased by 0.09 percentage points to 6.25%. The rate for the 15-year mortgage was 6.16% last week and 6.24% last year. 

Sam Khater, Freddie Mac's chief economist, said mortgage rates are likely to decline moderately in the second half of the year. 

"Mortgage rates increased this week, coming in just under seven percent. Both new home and pending home sales are down, causing active listings to rise," Khater said in a release. "We are still expecting rates to moderately decrease in the second half of the year and given additional inventory, price growth should temper, boding well for interested homebuyers."

How Mortgage Rates Are Calculated

Mortgage rates are determined by several factors, including the overall economic health, how the bond market reacts to the Federal Reserve's interest rate policy, and the moves in the 10-year Treasury Yield. 

In October last year, the average contract rate on a 30-year mortgage peaked at 8%, the first time reported since 2000. This came after the Fed rose interest rates in an attempt to bring down inflation. 

It is unclear when the Fed will cut its rate. Officials have said they see inflation moving closer to their target level of 2% and signaled they are expecting to cut the benchmark rate once this year. Many economists believe the Fed may cut rate in September, per ABC News

Should mortgage rates fall, it could give relief to hopeful homebuyers, especially potential first-time owners, who were priced out of the market. It could also entice more buyers back to the market after being discouraged due to high home loan borrowing costs and record-high home prices.

READ NEXT: Over 70% of Renters Struggle To Afford Housing: Survey