The way a bank works is that it borrows short to lend long. Simplistically, a bank might get its money from demand deposits, checking and savings accounts that customers can withdraw at any time. And the bank might pay, say, 0% interest on those deposits. And then it invests the money in some longer-term assets, loans and bonds that don’t get paid back for years, and that pay, say, 2% interest. The bank earns 2% on its money, pays 0% to depositors for the money, and keeps the spread, the net interest margin, which is 2% in this example.
Sometimes interest rates go up or down, though. Simplistically, short-term interest rates in the US are set by the Federal Reserve, which will raise interest rates to cool the economy if inflation is too high.