In a statement, JPMorgan called the agreement "an important step towards a broader resolution of the firm's" mortgage-related matters.
Edward DeMarco, the FHFA's acting director, said the settlement with JPMorgan "provides greater certainty in the marketplace."
The deal is expected to be followed by a broader agreement with the Justice Department and New York state authorities that's still being negotiated. Last weekend, JPMorgan reached a tentative agreement with Justice to pay $13 billion over bad loans and mortgage securities the bank sold before the crisis.
The $13 billion tentative deal included $4 billion to resolve the FHFA claims. Even reduced by that amount, it would be the largest penalty the government has extracted from a company for actions related to the financial crisis. It's unclear when the broader agreement will be finalized.
New York Attorney General Eric Schneiderman applauded the FHFA's settlement. "Five years after the financial crisis, it is critical that we continue to share resources to maximize the relief provided to struggling homeowners and ensure accountability for those who created the crisis in the first place," he said in a statement.
The FHFA sued 18 financial institutions in September 2011 over their sales of mortgage securities to Fannie and Freddie. The total price for the securities sold was $196 billion.
The government rescued Fannie and Freddie during the financial crisis when both were on the verge of collapse. The companies received taxpayer aid totaling $187 billion. They have since become profitable and repaid $146 billion.
New York-based JPMorgan will pay about $2.74 billion to Freddie and $1.26 billion to Fannie for the securities it sold. JPMorgan is also paying $1.1 billion for home loans it sold to Fannie and Freddie ahead of the crisis.
A number of big banks, including JPMorgan, Goldman Sachs and Citigroup, previously have been accused of abuses in sales of securities linked to mortgages in the years leading up to the crisis. Together, they have paid hundreds of millions in penalties to settle civil charges brought by the SEC, which accused them of deceiving investors about the quality of the bonds they sold.
No high-level Wall Street executives had been sent to jail over charges related to the financial crisis. And the banks in all the SEC cases were allowed to neither admit nor deny wrongdoing a practice that brought criticism of the agency from judges and investor advocates. That has triggered public outrage. Some lawmakers and other critics demanded that the big bailed-out banks and senior executives be held accountable.
JPMorgan has enjoyed a reputation for managing risk better than its Wall Street competitors. The bank came through the financial crisis in better shape than most of its rivals.
But in recent months, it has been engaged in a number of embarrassing and costly settlements.
In September, JPMorgan agreed to pay $920 million and admit that it failed to oversee trading that led to a $6 billion loss last year in its London operation. That combined amount, in settlements with three regulators in the U.S. and one in Britain, is one of the largest fines ever levied against a financial institution.
In another case, the company agreed to pay a $100 million penalty and admitted that its traders acted "recklessly" with the London trades.
And in a first for a major company, JPMorgan admitted in the agreement with the SEC over the trading loss in London that it failed in its oversight.