Bank of America, the second largest US lender is close to ending a landmark deal with US authorities to pay up to $17 billion – a record fine - to the Justice Department over its role in the 2007 financial crisis.

If completed, it will be largest single compensation settlement, surpassing the $13 billion JPMorgan Chase agreed to pay in 2013.

The compensation will come in two parts: $9 billion in cash and $7 billion in consumer relief, such as modified home loans and refinanced mortgages, the Financial Times cites people familiar with the matter.

The size of the fines facing Bank of America has been constantly rising. In June the bank assumed it would be at least $12 billion, in the middle of July lawyers offered the Justice Department $13 billion in the form of a fine and mortgage relief. However prosecutors kept upping the ante.

In March Bank of America agreed to pay $9.5 billion to settle a similar investigation by the Federal Housing Finance Agency (FHFA). In total, since the financial crisis the bank has paid out around $60 billion in fines, to settle claims, and buyout mortgage bonds.

Since the financial crisis US banks have had to pay more than $100 billion in penalties.

Bank of America, along with one of the largest issuers of bad mortgage loans Countrywide Financial, and Merrill Lynch, sold $965 billion in bad mortgage bonds between 2004 and 2008. Almost three quarters of them were issued by Countrywide Financial.