(Fortune Magazine) -- It's getting hard to wrap your brain around subprime mortgages, Wall Street's fancy name for junk home loans. There's so much subprime stuff floating around - more than $1.5 trillion of loans, maybe $200 billion of losses, thousands of families facing foreclosure, umpteen politicians yapping - that it's like the federal budget: It's just too big to be understandable.

So let's reduce this macro story to human scale. Meet GSAMP Trust 2006-S3, a $494 million drop in the junk-mortgage bucket, part of the more than half-a-trillion dollars of mortgage-backed securities issued last year. We found this issue by asking mortgage mavens to pick the worst deal they knew of that had been floated by a top-tier firm - and this one's pretty bad.

It was sold by Goldman Sachs (Charts, Fortune 500) - GSAMP originally stood for Goldman Sachs Alternative Mortgage Products but now has become a name itself, like AT&T and 3M.

This issue, which is backed by ultra-risky second-mortgage loans, contains all the elements that facilitated the housing bubble and bust. It's got speculators searching for quick gains in hot housing markets; it's got loans that seem to have been made with little or no serious analysis by lenders; and finally, it's got Wall Street, which churned out mortgage "product" because buyers wanted it. As they say on the Street, "When the ducks quack, feed them."

Alas, almost everyone involved in this duck-feeding deal has had a foul experience. Less than 18 months after the issue was floated, a sixth of the borrowers had already defaulted on their loans. Investors who paid face value for these securities - they were looking for slightly more interest than they'd get on equivalent bonds - have suffered heavy losses.

That's because their securities have either defaulted (for a 100% loss) or been downgraded by credit-rating agencies, which has depressed the securities' market prices. (Check out one of these jewels on a Bloomberg machine, and the price chart looks like something falling off a cliff.)

Even Goldman may have lost money on GSAMP - but being Goldman, the firm has more than covered its losses by betting successfully that the price of junk mortgages would drop. Of course, Goldman knew a lot about this market: GSAMP was just one of 83 mortgage-backed issues totaling $44.5 billion that Goldman sold last year.

Now let's take it from the top.

In the spring of 2006, Goldman assembled 8,274 second-mortgage loans originated by Fremont Investment & Loan, Long Beach Mortgage Co., and assorted other players. More than a third of the loans were in California, then a hot market. It was a run-of-the-mill deal, one of the 916 residential mortgage-backed issues totaling $592 billion that were sold last year.

The average equity that the second-mortgage borrowers had in their homes was 0.71%. (No, that's not a misprint - the average loan-to-value of the issue's borrowers was 99.29%.)

It gets even hinkier. Some 58% of the loans were no-documentation or low-documentation. This means that although 98% of the borrowers said they were occupying the homes they were borrowing on - "owner-occupied" loans are considered less risky than loans to speculators - no one knows if that was true. And no one knows whether borrowers' incomes or assets bore any serious relationship to what they told the mortgage lenders.

You can see why borrowers lined up for the loans, even though they carried high interest rates. If you took out one of these second mortgages and a typical 80% first mortgage, you got to buy a house with essentially none of your own money at risk. If house prices rose, you'd have a profit. If house prices fell and you couldn't make your mortgage payments, you'd get to walk away with nothing (or almost nothing) out of pocket. It was go-go finance, very 21st century.

Goldman acquired these second-mortgage loans and put them together as GSAMP Trust 2006-S3. To transform them into securities it could sell to investors, it divided them into tranches - which is French for "slices," in case you're interested.

There are trillions of dollars of mortgage-backed securities in the world for the same reason that Tyson Foods offers you chicken pieces rather than insisting you buy an entire bird. Tyson can slice a chicken into breasts, legs, thighs, giblets - and Lord knows what else - and get more for the pieces than it gets for a whole chicken. Customers are happy, because they get only the pieces they want.

Similarly, Wall Street carves mortgages into tranches because it can get more for the pieces than it would get for whole mortgages. Mortgages have maturities that are unpredictable, and they require all that messy maintenance like collecting the monthly payments, making sure real estate taxes are paid, chasing slow-pay and no-pay borrowers, and sending out annual statements of interest and taxes paid. Securities are simpler to deal with and can be customized.

Someone wants a safe, relatively low-interest, short-term security? Fine, we'll give him a nice AAA-rated slice that gets repaid quickly and is very unlikely to default. Someone wants a risky piece with a potentially very rich yield, an indefinite maturity, and no credit rating at all? One unrated X tranche coming right up. Interested in legs, thighs, giblets, the heart? The butcher - excuse us, the investment banker - gives customers what they want.

In this case, Goldman sliced the $494 million of second mortgages into 13 separate tranches. The $336 million of top tranches - named cleverly A-1, A-2, and A-3 - carried the lowest interest rates and the least risk. The $123 million of intermediate tranches - M (for mezzanine) 1 through 7 - are next in line to get paid and carry progressively higher interest rates.

Finally, Goldman sold two non-investment-grade tranches. The first, B-1 ($13 million), went to the Luxembourg-based UBS (Charts) Absolute Return fund, which is aimed at non-U.S. investors and thus spread GSAMP's problems beyond our borders. The second, B-2 ($8 million), went to the Morgan Keegan Select High Income fund. (Like most of this article, this information is based on our reading of various public filings; UBS and Morgan Keegan both declined to comment.)

Goldman wouldn't say, but it appears to have kept the 13th piece, the X tranche, which had a face value of $14 million (and would have been worth much more had things gone as projected), as its fee for putting the deal together. Goldman may have had money at risk in some of the other tranches, but there's no way to know without Goldman's cooperation, which wasn't forthcoming.

How is a buyer of securities like these supposed to know how safe they are? There are two options. The first is to do what we did: Read the 315-page prospectus, related documents, and other public records with a jaundiced eye and try to see how things can go wrong.

The second is to rely on the underwriter and the credit-rating agencies - Moody's and Standard & Poor's. That, of course, is what nearly everyone does.

In any event, it's impossible for investors to conduct an independent analysis of the borrowers' credit quality even if they choose to invest the time, money, and effort to do so. That's because Goldman, like other assemblers of mortgage-backed deals, doesn't tell investors who the borrowers are.

One Goldman filing lists more than 1,000 pages of individual loans - but they're by code number and zip code, not name and address.

Even though the individual loans in GSAMP looked like financial toxic waste, 68% of the issue, or $336 million, was rated AAA by both agencies - as secure as U.S. Treasury bonds. Another $123 million, 25% of the issue, was rated investment grade, at levels from AA to BBB--.

Thus, a total of 93% was rated investment grade. That's despite the fact that this issue is backed by second mortgages of dubious quality on homes in which the borrowers (most of whose income and financial assertions weren't vetted by anyone) had less than 1% equity and on which GSAMP couldn't effectively foreclose.

It's all in the math

How does toxic waste get distilled into spring water? Watch. It's all in the math - and the assumptions about how borrowers will behave.

These loans, which are fixed-rate, carried an average interest rate of 10.51%. After paying the people who collected the payments and handled all the other paperwork, the GSAMP Trust had ten percentage points left. However, the interest on the securities that GSAMP issued ran to only about 7%. (We say "about" because some of the tranches are floating-rate rather than fixed-rate.)

The difference between GSAMP's interest income and interest expense was projected at 2.85% a year. That spread was supposed to provide a cushion to offset defaults by borrowers. In addition, the aforementioned X piece didn't get fixed monthly payments and thus provided another bit of protection for the 12 tranches ranked above it.

Remember that we're dealing with securities, not actual loans. Thus losses aren't shared equally by all of GSAMP's investors. Any loan losses would first hit the X tranche. Then, if X were wiped out, the losses would work their way up the food chain tranche by tranche: B-2, B-1, M-7, and so on.

The $241 million A-1 tranche, 60% of which has already been repaid, was designed to be supersafe and quick-paying. It gets first dibs on principal paydowns from regular monthly payments, refinancings, and borrowers paying off their loans because they're selling their homes. Then, after A-1 is paid in full, it's the turn of A-2 and A-3, and so on down the line.

Moody's projected in a public analysis of the issue that less than 10% of the loans would ultimately default. S&P, which gave the securities the same ratings that Moody's did, almost certainly reached a similar conclusion but hasn't filed a public analysis and wouldn't share its numbers with us. As long as housing prices kept rising, it all looked copacetic.

Goldman peddled the securities in late April 2006. In a matter of months the mathematical models used to assemble and market this issue - and the models that Moody's and S&P used to rate it - proved to be horribly flawed. That's because the models were based on recent performances of junk-mortgage borrowers, who hadn't defaulted much until last year thanks to the housing bubble.

The fallout

Through the end of 2005, if you couldn't make your mortgage payments, you could generally get out from under by selling the house at a profit or refinancing it. But in 2006 we hit an inflection point. House prices began stagnating or falling in many markets. Instead of HPA - industry shorthand for house-price appreciation - we had HPD: house-price depreciation.

Interest rates on mortgages stopped falling. Way too late, as usual, regulators and lenders began imposing higher credit standards. If you had borrowed 99%-plus of the purchase price (as the average GSAMP borrower did) and couldn't make your payments, couldn't refinance, and couldn't sell at a profit, it was over. Lights out.

As a second-mortgage holder, GSAMP couldn't foreclose on deadbeats unless the first-mortgage holder also foreclosed. That's because to foreclose on a second mortgage, you have to repay the first mortgage in full, and there was no money set aside to do that. So if a borrower decided to keep on paying the first mortgage but not the second, the holder of the second would get bagged.

If the holder of the first mortgage foreclosed, there was likely to be little or nothing left for GSAMP, the second-mortgage holder. Indeed, the monthly reports issued by Deutsche Bank (Charts), the issue's trustee, indicate that GSAMP has recovered almost nothing on its foreclosed loans.

By February 2007, Moody's and S&P began downgrading the issue. Both agencies dropped the top-rated tranches all the way to BBB from their original AAA, depressing the securities' market price substantially.

In March, less than a year after the issue was sold, GSAMP began defaulting on its obligations. By the end of September, 18% of the loans had defaulted, according to Deutsche Bank.

As a result, the X tranche, both B tranches, and the four bottom M tranches have been wiped out, and M-3 is being chewed up like a frame house with termites. At this point, there's no way to know whether any of the A tranches will ultimately be impaired.

"[In hindsight,] I think we would not have rated it" had Moody's realized what was going on in the junk-mortgage market, says Nicolas Weill, the firm's chief credit officer for structured finance. Low credit scores and high loan-to-value ratios were taken into account in Moody's original analysis, of course, but the firm now thinks there were things it didn't know about.

Weill doesn't lay blame on any particular party, although in a Sept. 25 special report posted on Moody's website, he called for "additional third-party oversight that reviews the accuracy of the information provided by borrowers, appraisers, and brokers to originators" when it comes to junk issues. Or, as he calls them, "non-prime."

S&P, by contrast, says that it considers both its original rating and subsequent downward revisions correct. "We used the best information available at the time," says Vickie Tillman, S&P's chief rating officer.

If you read documents that Goldman filed with the SEC in connection with this offering, you discover that they warn about pretty much everything we've discussed so far and some things we haven't: the impact of falling house prices, the difficulty of foreclosing, the possible changes in credit ratings, the fact that more than half the mortgages were in California, Florida, and New York, all of which were overheated markets.

It's all disclosed. In capital letters. So no buyer - and this is aimed at sophisticated investors - can say he wasn't warned.

Goldman said it made money in the third quarter by shorting an index of mortgage-backed securities. That prompted Fortune to ask the firm to explain to us how it had managed to come out ahead while so many of its mortgage-backed customers were getting stomped.

Goldman's profits came from hedging the mortgage securities it keeps in inventory in order to make trading markets. It said in a recent SEC filing, "Although we recognized significant losses on our non-prime mortgage loans and securities, those losses were more than offset by gains on short mortgage positions."

As we interpret this - the firm declined to elaborate - Goldman made more on its hedges than it lost on its inventory because junk mortgages fell even more sharply than Goldman thought they would.

What is there to take away from our course in Junk Mortgages 101? Two things. First, you have to pay at least some attention to all those "risk factors" that issuers forever warn you about - especially when you're dealing with a whole new thing like junk mortgages issued en masse instead of by specialists.

Second, when you rely on the underwriter and the rating agencies to do all your homework for you, you don't have safety. You have only the illusion of safety.

Reporter Associate Doris Burke contributed to this article.