Moody’s Corp. said Friday it agreed to pay $864 million to the U.S. Department of Justice and several states in connection with bond grades it issued before the 2008 housing-market collapse.

The agreement marks what is expected to be the last in a series of deals in the waning days of President Barack Obama’s administration closing investigations into the financial crisis.

Late...