How is the interest rate on a loan secured by real estate determined?

How is the interest rate on a loan secured by real estate determined?