That something is the rating. Credit markets are not continuous; a bond that qualifies, though only by a hair, as investment grade is worth a lot more than one that just fails. As with a would-be immigrant traveling from Mexico, there is a huge incentive to get over the line.

The challenge to investment banks is to design securities that just meet the rating agencies’ tests. Risky mortgages serve their purpose; since the interest rate on them is higher, more money comes into the pool and is available for paying bond interest. But if the mortgages are too risky, Moody’s will object. Banks are adroit at working the system, and pools like Subprime XYZ are intentionally designed to include a layer of Baa bonds, or those just over the border. “Every agency has a model available to bankers that allows them to run the numbers until they get something they like and send it in for a rating,” a former Moody’s expert in securitization says. In other words, banks were gaming the system; according to Chris Flanagan, the subprime analyst at JPMorgan, “Gaming is the whole thing.”

When a bank proposes a rating structure on a pool of debt, the rating agency will insist on a cushion of extra capital, known as an “enhancement.” The bank inevitably lobbies for a thin cushion (the thinner the capitalization, the fatter the bank’s profits). It’s up to the agency to make sure that the cushion is big enough to safeguard the bonds. The process involves extended consultations between the agency and its client. In short, obtaining a rating is a collaborative process.

The evidence on whether rating agencies bend to the bankers’ will is mixed. The agencies do not deny that a conflict exists, but they assert that they are keen to the dangers and minimize them. For instance, they do not reward analysts on the basis of whether they approve deals. No smoking gun, no conspiratorial e-mail message, has surfaced to suggest that they are lying. But in structured finance, the agencies face pressures that did not exist when John Moody was rating railroads. On the traditional side of the business, Moody’s has thousands of clients (virtually every corporation and municipality that sells bonds). No one of them has much clout. But in structured finance, a handful of banks return again and again, paying much bigger fees. A deal the size of XYZ can bring Moody’s $200,000 and more for complicated deals. And the banks pay only if Moody’s delivers the desired rating. Tom McGuire, the Jesuit theologian who ran Moody’s through the mid-’90s, says this arrangement is unhealthy. If Moody’s and a client bank don’t see eye to eye, the bank can either tweak the numbers or try its luck with a competitor like S.&P., a process known as “ratings shopping.”

And it seems to have helped the banks get better ratings. Mason, of Drexel University, compared default rates for corporate bonds rated Baa with those of similarly rated collateralized debt obligations until 2005 (before the bubble burst). Mason found that the C.D.O.’s defaulted eight times as often. One interpretation of the data is that Moody’s was far less discerning when the client was a Wall Street securitizer.

After Enron blew up, Congress ordered the S.E.C. to look at the rating industry and possibly reform it. The S.E.C. ducked. Congress looked again in 2006 and enacted a law making it easier for competing agencies to gain official recognition, but didn’t change the industry’s business model. By then, the mortgage boom was in high gear. From 2002 to 2006, Moody’s profits nearly tripled, mostly thanks to the high margins the agencies charged in structured finance. In 2006, Moody’s reported net income of $750 million. Raymond W. McDaniel Jr., its chief executive, gloated in the annual report for that year, “I firmly believe that Moody’s business stands on the ‘right side of history’ in terms of the alignment of our role and function with advancements in global capital markets.”

Using Weather in Antarctica To Forecast Conditions in Hawaii

Even as McDaniel was crowing, it was clear in some corners of Wall Street that the mortgage market was headed for trouble. The housing industry was cooling off fast. James Kragenbring, a money manager with Advantus Capital Management, complained to the agencies as early as 2005 that their ratings were too generous. A report from the hedge fund of John Paulson proclaimed astonishment at “the mispricing of these securities.” He started betting that mortgage debt would crash.