Want a cheap mortgage? Move to these states

interest rates
Borrowers in Rhode Island paid an average rate of just 3.4% on mortgages in July, the lowest in the nation.

Your credit score isn't the only thing determining whether or not you get a good rate on your mortgage. Where you live can also have a big impact.

In fact, interest rates can vary dramatically from state-to-state.

And borrowers in Rhode Island are benefiting the most, according to a survey by loan information sites GoBankingRates and RateWatch. Borrowers there paid an average rate of just 3.4% on mortgages in July, about 0.35 percentage points below the national average.

Related: Best cities for Millennial homebuyers

Nebraska's residents weren't so lucky: They paid an average of 4.1%, the highest rate in the nation

Over 30 years, that seemingly tiny 0.7 percentage-point difference means that a $200,000, 30-year loan would eventually cost $28,800 more in Nebraska than it would in Rhode Island.

So what gives? On a national level, mortgage rates move in tandem with U.S. bond yields. Yet, several local factors, like property values, competition and risk, can impact rates as well.

In areas where the economy is struggling and fewer people have jobs, lenders need to lower rates in order to attract borrowers. If the economy is booming, then they can afford to bump rates higher.

Related: Buy v rent. What you'll pay in 10 biggest cities

Borrowers also tend to see lower rates in places where home prices are higher. That's because lenders incur many fixed, transaction costs. It can be just as expensive to process a $100,000 mortgage as a $300,000 one so lenders make up for that by charging higher rates for the smaller loans.

Don't count out millennials
Don't count out millennials

Risk is also a factor. The lower the average credit score in an area, the higher the rates. Also, states that make it easier to foreclose on delinquent buyers tend to be cheaper, according to James Zussman, a business development associate for RateWatch.

Find Homes For Sale

LendingTree

CNNMoney Sponsors