Bank of America, the second-largest U.S. bank by assets under management, posted better-than-expected quarterly results.