Source: Brian Katt

Bank of America (NYSE:BAC) shares closed Wednesday down nearly 2% following the second-quarter report. Profits suffered due to litigation expenses,  but the company pulled of an earnings surprise in a segment thwarting competition such as Citigroup and Goldman Sachs.

What were the key takeaways from Bank of America's second quarter? 

Analysts had expected $21.7 billion in revenue and $0.29 EPS. Bank of America reported $22 billion with an EPS of $0.19 per diluted share. The earnings beat reflects a mixed bag of segment performances overshadowed by legal disputes.  

What do investors need to know about Bank of America's earnings report?  

1. Legal woes
Litigation expenses tied to an AIG mortgage securities lawsuit cost Bank of America about $0.22 per share after tax. AIG's original suit, filed in 2011, had asked for $10 billion to cover losses during the housing crisis. The settlement amounted to $4 billion pre-tax, but also led to AIG dropping its opposition to the bank's $8.5 billion settlement with a large group of mortgage investors. 

Bank of America's legal troubles will continue past the second-quarter report.

The company continues to fight the Department of Justice on   related to mortgages. The DOJ wants around $17 billion and Bank of America has offered $12 billion-$13 billion. One factor in Bank of America's favor is the DOJ's new settlement with Citigroup. The DOJ had wanted $12 billion out of Citigroup but the settlement announced this week was for $7 billion.

2. Beating the competition on trading
Trading segments were down across the industry due to customer apprehension and lower interest rates.

Bank of America was the standout in having a trading arm post a year-over-year growth. Fixed income, currency, and commodities were up over 5% to $2.4 billion after excluding net debt value adjustment. Compare that growth to fixed-income declines of 12% at Citigroup and 10% at Goldman Sachs. 

Bank of America only managed the comparative growth due to a weak second quarter last year and fixed income was partly offset by the 14% drop in equity trading revenue. The global markets segment managed to close the quarter up 9% thanks to the fixed income performance and increased investment fees.   

3. Mixed segmental results beyond trading
Bank of America joined Goldman Sachs in having more segments reporting a growth than a loss. Consumer and Business Banking was flat year-over-year on revenue but net income jumped 29%. Growth drivers included cost reduction and increased service charges. 

Global wealth and investment management saw a slight segmental revenue growth but net income dropped nearly 5%. Managed assets and client balances increased in the quarter, but the return on average allocated capital fell more than 6%. 

Consumer real estate services were the underperformer with a net loss of $2.8 billion -- thanks to the litigation expenses -- and a $725 million drop in revenue from the prior year's quarter. Don't expect this segment to show a notable improvement anytime in the near future as the housing market struggles upward; first-mortgage originations were down 59% in the quarter. 

Foolish final thoughts
Trading and mortgages will remain weak moving forward but those are industrywide concerns. Investors need to watch for a potential DOJ settlement and hope that Bank of America gets the same sort of bargain given to Citigroup.