After rereading the article below and help from wikipedia, I finally understood how to transform BBB debt into AAA debt, and the whole colateralized debt obligation (CDO) thing that seemed so magical and is supposed to have gotten us in the mess.
The trick is actually quite simple. It says put all your BBB together in a company (SPV or Special Purpose Vehicle) and redistribute payments from the lot to create a sub AAA tranche. The investors in that tranche are holding on to a AAA rated security.
By redistributing the cash flows, you can in fact extract 10% of AAA and leave 90% residue that is worse than the original BBB. Making up numbers here.
Investors awash in leverage, loved to consume the AAA tranche, plus some entities can only buy AAA securities. Bankers loved to make them.
Furthermore I am under the impression from reading this article that they in fact recycled the leftovers from the first CDO process into another CDO. Except at that level you are stretching to find a cash flow that are in fact alive in that cesspool and I guess it is easy to mis-rate these second derivative securities. Apparently rating agencies applied ratings to the various CDO tranches without much understanding of the underlying security.