The other posters aren't correct. The actual reasoning is that the banks, as tenants, impart a top-flight credit score to a substantial portion of the building's finances if the leases are designed the right way. In return for the slightly more demanding leases which allow the credit-score to functionally pass through, they receive a substantial rebate on the market rate of their leased locations over long periods, affording them cheap arbitrage opportunities - if real estate prices and rents soar, they're still locked in below market rate at the pre-boom rates. If they don't, and rates go down, they have a substantial buffer before the market value of their leasehold is negative.
Easier than giving out business loans. All those new branches will disappear in a few years as real estate profits peak.