Can banks buy stocks? Can a bank use its excess reserves to purchase stocks? If so, does this inflate the cost of borrowing for your average Joe since he has to offer returns (interest payments) that are competitive with stock market returns? Or, on the other hand, maybe a personal loan with collateral is competitive when you consider the low risk?
1st of all, banking regulation in different, in various countries, so there is no 1 accurate answer for all cases.

Having that said, In general, banks may buy stocks, but that won't be with any capital being held as a deposit reserve ratio, or Basel regulation recommendations.
This is because a bank has to keep enough capital allocated per loan.
Furthermore, when a bank recruits capital in order to lend it, it becomes its own debt, rather than capital. The bank lending money is its asset, which should be alternative to stock buying

When a bank buys a stock, its done from it Nostro account, dedicated for investments and is seperate from its "classic" activity

Of course diversions from the theoretical model do exist, in cases like the Sub-prime bubble of 2008. but, obviously,the large banks back then, in fully aware manner, broke their own business model rules, in a fraudulent way