What do America’s banks know about the state of the U.S. economy that has them hoarding ultra-safe bonds?

Growth is on a tear, hiring is the strongest in decades and households are the most upbeat since 2011. Yet banks such as Bank of America Corp. keep plowing their burgeoning deposits into U.S. government and related debt—pushing the industry’s holdings past $2 trillion—instead of lending it all out.