Why do banks charge and pay interest?
When a bank accepts a deposit, it pays an interest rate to the depositor as payment for that deposit. This is because the bank will then use that money to issue loans. The loans also have an interest rate, for two reasons. First, the bank wants to generate profit. Second, the bank knows that loans have risk of default. If a borrower does not repay the bank, the loan is considered non-performing. This is costly for the bank, since some or all of the loan value is lost.
Interest rate drivers
In addition to changes in the federal funds rate, expectations of inflation affect interest rates, particularly of longer loan maturities such as mortgages. Similarly, having a lower credit score signals that a borrower carries a higher default risk. Banks charge these borrowers higher interest rates to account for that risk.