Interest is essentially the price of trust and liquidity (which is very similar !).
Of course trust is a factor (people with lower credit rating pay higher interest), but the primary factor is opportunity cost.
If I have money, I can choose to either invest it or loan it. If I loan it at no interest, then I have lost any money I could have made by investing it. If you want me to loan you money that I could otherwise invest, it is going to cost you.
True, which is why I don't understand why some people have a hard time accepting interests. Every action while opening options, also limit you by closing of other paths not chosen. In addition to losing the option to use the money you have lent, prices rise, if you just loan out money without interest, by the time it is returned, it would have already lost some value. In short, you can even say you lost money!
I'm not sure with commercial banks but maybe part of the interest is also used to reduce the damages from defaults. I mean, I heard that's the real reason loansharks charge a high interest.
The good thing these days is that people who are not eligible for loans have a bit more option to obtaining funding, depending on the nature of their enterprise.