By this definition prime loans are also gambling. When you bet on something risky then you are gambling. When you bet on something not risky you are not gambling. Also consider that not investing will generally lose money over time due to things like inflation. If we define the goal to be holding as much value as we can, holding dollars is more risky than investing in many stocks (or bonds, which also have a risk of defaulting). A better definition of gambling is something like "taking unnecessary and unproductive risks."

I'm not sure I buy any definition of gambling that depends on the outcome. If you lose money or tend to lose money, then it's gambling, but if you win money or tend to win money, then we change the name to "investing?" Risk includes upside and downside risk.

It doesn't depend on the outcome. If a bank only does prime loans and spreads out it's loans multiple borrowers, has a good reserve ratio etc. and still loses it all, that still wasn't gambling. This is more clear if you consider that storing value in money is also risky. When you get paid in a currency, you automatically begin investing in it at the same time. This is even more clear with foreign currencies. If you got paid $1 million in Turkish Lyra and do not store that value somewhere else, that is more gambling-like than putting it in the S&P. I guess you can say that any time you increase the amount of risk in an investment to get more reward you are gambling. But you can invest in something other than USD with the same risk but with greater reward. For example you can invest it in US bonds (over multiple issues) which has a similar risk to the USD but a greater reward. Still, under such a definition, any business is gambling. We can accept that, but then we have no word that differentiates owning a grocery store from betting all your money on a coin flip, so then the word "gambling" becomes much less useful or really useless in my opinion.