Interest rates on loans, also referred to as borrow APR, are calculated to reflect supply and demand for capital in lending markets. Supply is represented by lenders supplying liquidity or capital, and demand is represented by borrowers who seek capital in exchange for depositing collateral.
If there is an abundance of capital allocated to a market, more than is necessary, interest rates will be low. If however there is a shortage of capital in another market, which means strong demand with low supply, then interest will be higher.
This incentivises capital to be allocated where it is most needed. Interest rates become a signal for lenders to indicate where money is most needed, and where in turn they can get the highest return on their capital.