Affordable housing shortages and declining loan volumes are making it difficult for banks to originate enough mortgages to meet their Community Reinvestment Act obligations, which could make filling shortfalls with loans from nonbanks more expensive.