You’re thrilled that you just refinanced your mortgage to a new 30-year fixed-rate loan with an interest rate of 3.8 percent. But then your neighbor tells you that she just refinanced her loan to a 30-year fixed-rate loan with an interest rate of 3.3 percent.

Now you’re angry. Why is your neighbor’s mortgage rate lower than yours?

It’s not just dumb luck that your neighbor, co-worker, family member of friend nabbed a lower mortgage interest rate. Much goes into determining the interest rate attached to a mortgage.

How'd they get such a low rate?

Susan Fisher, a mortgage lender with River Valley Bank in Dane, Wisconsin, said that there always is a real financial reason for your higher interest rate. It’s not just luck that your neighbor, friend or family member has secured a lower one, she said.

“There are many reasons for rate fluctuation, such as loan program, down payment, credit score, debt-to-income ratios and whether they paid points to buy down the rate, Fisher said.

But the most common reason why your rate is higher? It usually comes down to your FICO credit score.

“This is a strong indicator that your neighbor’s FICO credit score is higher than yours,” said Tom Diem, president of Diem Wealth Management in Fort Wayne, Indiana. “Mortgage companies, like other lending companies, use your score to determine what interest you will get on your loans. A higher score will often get a lower interest rate and a lower score will result in higher interest rates for borrowing money.”

The power of your FICO credit score

The one factor that has more of an impact on your interest rate than any other is your three-digit FICO credit score. The lower your FICO score, the higher your interest rate.

That’s because your FICO score is an indication of how well you’ve paid your bills on time in the past. If you’ve paid credit-card bills or car payments late, for example, your FICO score will fall. Lenders see a low FICO score and will either deny you mortgage dollars or charge you a higher interest rate to make up for the increased risk they are taking on by lending you money.

In general, lenders consider FICO credit scores of 740 or higher to be top scores. They’ll hit you with higher interest rates for scores that are lower.

“Your credit score is basically a grade on how well you pay back money that you borrow,” said Matthew Coan, founder of personal-finance site Casavvy.com. “Lenders want to give themselves the best shot at getting their money back. By charging people with a lower credit score more interest, they are earning more in return upfront, lowering their risk of you not paying off the principle of your loan.”

Timing matters, too

The timing of your loan or refinance application matters, too. Interest rates rise and fall all the time.

Freddie Mac, in its Primary Mortgage Market Survey, said that the average interest rate on a 30-year, fixed-rate mortgage loan stood at 3.43 percent for the week ending August 4. Just a week before, that rate stood at a higher 3.48 percent. One year earlier, it was 3.91 percent.

So if you applied for a loan a year earlier than your neighbor, it's not surprising that your interest rate might be higher.

The type of loan you take out plays a role

The type of mortgage you take out also plays a large role in your interest rate. If you took out a 30-year fixed-rate mortgage and your neighbor is paying off a 15-year fixed-rate loan, the odds are that your neighbor's interest rate will be lower. Lenders charge lower interest rates on shorter-term loans.

David Hosterman, branch manager with Castle & Cooke Mortgage in Greenwood Village, Colorado, said that mortgages insured by the Federal Housing Administration, U.S. Department of Veterans Affairs and the U.S. Department of Agriculture generally come with lower interest rates than do conventional mortgages not insured by a government agency.

Neighbors' interest rates might be lower, too, because they paid for them. Consumers can pay for points that lower their mortgage interest rates. Maybe your co-workers with lower rates paid upfront for them.

Consumers generally qualify for lower rates, too, when they put down larger down payments on their mortgages. Because such consumers have already invested more money in their mortgages, lenders consider them lower risks, and are willing to reward them with lower interest rates.

The bottom line? There are plenty of potential reasons why your neighbor’s interest rate is higher than yours. Don’t take this personally. If you want a lower rate next time you take out a purchase mortgage or refinance? Improve your own financial situation to increase the odds that you’ll be the one of which your neighbors are jealous.

“With conventional loans, a consumer really wants a credit score above 740 and loan-to-value ratio of 60 percent to get the lowest rates possible,” Hosterman said.