The idea that a home loan is risk-free ignores decades of recent history. A quick google search for "2008 GFC" will bring you up to speed.
Given that home loans are not, in fact, risk-free, how do you expect anyone to risk the large up front cost of financing a home if they do not have any expectation of profit? The small profit that landlords make off of these investments is mostly that risk premium. As a tenant, I am not liable to the bank for hundreds of thousand of dollars if any one of hundreds of calamities outside of my control were to occur rendering my home worthless. In exchange for this relative lack of risk, I gladly pay the 2% premium to my landlord. This is not to mention the benefit of mobility, among others.
Home loans are one of the most accessible loans in modern western civilization, so no, banks don't "always choose people who are already wealthy."
I assure you that if we were to remove the profit motive from financing the development of housing stock, there would be far less of it and home prices would certainly increase.