Banks can make money many ways. Their primary source of income is maturity transformation β taking short term liabilities and turning them into long term assets, collecting the spread between the two rates.
Fees are also a large part of certain banks income statements. It ranges widely: wealth management, payment processing, trading, private equity, deposit fees, fintech services, investment banking, mortgage banking, loan sales, insurance, etc.
The most profitable banks normally have a low cost structure (generally judged by efficiency ratio) or a significant fee income source (insurance, payment processing).