Bank of America (BAC) will award $22 million in grants to nonprofit agencies to counsel homeowners at risk of foreclosure and rehab dilapidated neighborhoods.

The grants will go to more than 650 nonprofits in 34 states. The agencies expect to provide 8,000 new affordable housing units and rehab 11,000 more with the money.

National agency Mercy Housing will use its $375,000 grant to fund its counseling and rebuilding programs in several states. Most of the money will go to local nonprofits however. Plymouth Housing Group in Seattle, Wash., will use $25,000 to build apartments for homeless adults recovering from addiction.

The bank still faces billions in buyback claims and troubled mortgages as a result of the housing bust and its acquisition of Countrywide.

More than 1 million home loans it services are still 60 days or more delinquent, which declined by 214,000 over the last year.

BofA said its grant program will continue to focus on low- and moderate-income areas hardest hit by the downturn.

"We continue to look for ways to support innovative programs that will help individuals and families access and retain affordable housing," said Kerry Sullivan, president of the BofA charitable foundation.