Mark Lennihan, File, Associated Press
In this Jan. 14, 2015 file photo, people walk past a branch of Bank of America in New York. Bank of America reports quarterly financial results on on Wednesday, April 15, 2015.

NEW YORK — Bank of America returned to profitability in the first quarter as the bank was able to move forward from its legal troubles last year. However, the results came in short of some analysts' estimates.

The consumer banking giant said Wednesday that it earned $2.98 billion after payments to preferred shareholders, compared with a loss of $514 million a year earlier. Net revenue fell to $21.2 billion compared with $22.56 billion in the same period a year earlier.

On a per-share basis the bank earned 27 cents, compared with a loss of 5 cents a year earlier. The Charlotte, N.C.-based bank had $6 billion in legal expenses last year, causing the company to report a loss.

Bank of America's results missed expectations. Financial analysts surveyed by FactSet expected 29 cents per share, which typically excludes one-time items.

Bank of America's consumer banking division, its largest business by revenue, reported flat results in the quarter. Net revenue for the consumer bank was $7.45 billion, down from $7.65 billion a year earlier. The bank said lower credit card yields and credit card balances, as well as market-related adjustments to some debt securities, were the reason for the flat to lower quarter.

Low interest rates also hurt BofA's results, with net interest income falling from $10.3 billion to $9.7 billion across the firm. BofA is more exposed to low interest rates than some banks since its more consumer centric, unlike JPMorgan Chase or Goldman Sachs, which have large trading operations.