S&P Global's Standard & Poor's entered into a similar accord in 2015 paying out $1.375 billion. Standard and Poor's is the world's largest ratings firm, followed by Moody's.
Moody's said it would pay a $437.5 million penalty to the Justice Department, and the remaining $426.3 million would be split among the states and Washington, D.C.
As part of its settlement, Moody's also agreed to measures designed to ensure the integrity of credit ratings going forward, including keeping analytic employees out of commercial-related discussions.
The rating agency's chief executive also must certify compliance with the measures for at least five years.
Moody's said that it stands behind the integrity of its ratings and noted that the settlement contains no finding of a violation of law or admission of liability.
Moody's said it already has implemented some of the compliance measures in the agreement.
Moody's shares closed at $96.96 on Friday. The stock plummeted more than 5 percent on Oct. 21, the day it disclosed the Justice Department had notified the firm it was planning to sue over the ratings.
Moody's settlement on Friday resolved the Justice Department probe without a federal lawsuit. In the Standard & Poor's case, resolution was reached after the U.S. filed a $5 billion fraud suit.
Connecticut, whose attorney general helped lead negotiations, filed a lawsuit against Moody's in 2010. Mississippi and South Carolina later sued, and other states had potential claims.
Connecticut's lawsuit claimed that Moody's ratings were influenced by its desire for fees, despite claims of independence and objectivity. It also accused Moody's of knowingly inflating ratings on toxic mortgage securities.
Moody's ratings were "directly influenced by the demands of the powerful investment banking clients who issued the securities and paid Moody's to rate them," Connecticut Attorney General George Jepsen said in a statement on Friday.