Overly optimistic credit ratings of complex structured financial products, particularly in residential mortgage-backed securities (RMBS), are widely cited as contributing to the recent financial crisis. We use a unique comprehensive data set, precisely linking RMBS deals, securities, and over 18.1 million mortgage loans, to reveal the flaws of the securitization process and the extent of rating inflation in three dimensions: (a) across the different types of non-agency RMBS (subprime, Alt-A, and prime jumbo), (b) among the three leading credit rating agencies (S&P, Moody’s, and Fitch), and (c) over the entire business cycle (growth, boom, and recession) between 2002 and 2008. We find significant mismatches between the published ratings and the underlying risk between 2004 and mid-2007. During this period, loan quality deteriorated, the level of credit enhancement weakened, and the credit rating agencies failed to address the increased risk, all of which contributed to overall rating inflation.