After months of negotiations, Bank of America agreed to pay more than $16 billion to settle investigations into its sale of toxic mortgage securities, the largest federal settlement in U.S. corporate history, the New York Times DealBook blog reported yesterday. The settlement started to take shape last week after the Justice Department rejected yet another settlement offer from the bank. Bank of America’s negotiating leverage took a hit this week when U.S. District Judge Jed S. Rakoff ordered the bank to pay nearly $1.3 billion for selling 17,600 loans, many of which were defective. Bank of America had previously lost that case, which involved its Countrywide Financial unit, at a jury trial.