WASHINGTON — The cost of borrowing money to buy a home rose slightly this week, but remains historically low.

The average rate on 30-year fixed-rate mortgages rose to 3.99 percent, from 3.95 percent last week, mortgage buyer Freddie Mac said. This week's rate matches a 5-month high set two weeks ago. A year ago, the 30-year rate averaged 4.12 percent.

The low rates — anything below 4 percent is low by historical standards — are some consolation for home buyers dealing with rising prices amid a shortage of supply.

The interest charged on U.S. Treasury notes has risen, causing mortgage rates to tick up in response. The yield on the 10-year Treasury reached its highest level since March at one point Thursday before pulling back.

The rate on 15-year fixed-rate mortgages, popular among homeowners who are refinancing, increased to an average 3.44 percent from 3.38 percent in the prior week. The 15-year rate averaged 3.37 percent a year ago.

The average on five-year adjustable-rate mortgages rose to 3.46 percent from 3.45 percent last week. Average rates on 5-year adjustable-rate mortgages were 3.23 percent last year at this time.

To calculate average mortgage rates, Freddie Mac surveys lenders across the country between Monday and Wednesday each week. The average doesn't include extra fees, known as points, which most borrowers must pay to get the lowest rates.