How could Donald Trump claim such a massive loss -- nearly a billion bucks -- on his 1995 tax return and yet still seem so rich?

It's not nearly as strange as it seems.

Here's why: The tax code favors rich business owners like Trump, especially those in real estate. Their sources of income and investments are vaster and more diverse than those of most individuals. And so are the tax breaks.

Unlike the average Joe, "the big guys have a lot of flexibility, both in claiming large write offs and using them wherever they like," said tax lawyer Steven Rosenthal, a senior fellow at the Tax Policy Center.

Trump typically structures his business entities as limited liability corporations and limited partnerships, and the rules governing those structures offered him several advantages over the years.

For instance, as long as he actively operates a business, he can use losses from it to offset profits in his other ventures, such as royalties from his books or licensing fees from others using the Trump name.

What's more, Trump's enterprises and other businesses are allowed to carry over their net operating losses for 15 to 20 years, real estate tax expert Richard Lipton said.

Boffo tax benefits in the 1990s

The 1990s were an especially sweet time tax-wise for real estate developers, Lipton noted.

It's not at all clear how or when Trump generated his $916 million loss from the top page of his state tax returns from 1995, which the New York Times obtained. But the tax laws at the time let developers like Trump make serious bank even if a real estate project failed, and all without their incurring much financial risk.

Say a developer put down $1 million of his own money and borrowed $99 million to buy and develop a property through a legal entity in which he was the general partner.

Eventually the venture fails.

The developer would still owe the lender money. But in the 1990s lenders often forgave debt on a failed property because it otherwise would have messed up their balance sheets, Lipton said.

Once the debt was forgiven, the law (since changed) let the developer claim a tax loss for the full $100 million on the property, even though he only put $1 million of his own money on the line.

Related: "I have legally used the tax laws to my benefit," Trump says

And bonus: While others may have owed income taxes on the forgiven debt, the developer would not have because of a special rule in place at the time.

Wait, there's more.

The borrowed money created three other big benefits: The developer got the money tax free when the loan was made. He was allowed to deduct any interest he paid on the loan. And the forgiveness of the debt generated a huge tax loss for him. That large tax loss, in turn, could offset his future taxable income, thereby shrinking if not eliminating any income taxes he might owe for years to come.

So what about the rest of us?

Now most Americans have a lot of tax breaks that they can take, too. The only difference is that those breaks are less flexible, smaller and more easily overseen by the IRS.

Consider the small-time investor. If he loses money on a stock he doesn't have to pay tax on winning investments he may have in future years. But capital losses only offset capital gains and up to $3,000 in ordinary income. There's a tax benefit for 401(k)s and IRAs, but contributions are limited.

Related: Why Trump owes it to voters to release his tax returns

Or consider regular homeowners. They may have to pay tax when they sell their home if their capital gains on the house exceed a certain threshold. But if they sell their home for less than they paid for it? They can't claim a capital loss.

Or take the average working American who has a paycheck and maybe some income from interest and dividends. The IRS gets W2s and 1099s to verify that income so it's easy to spot if a tax filer tries to fudge the numbers.

"The average Joe can't shelter payroll income, bank interest and the like," Rosenthal said. "The IRS is very good at matching information returns that are provided by employers and banks. But it has a hard time unraveling what's going on in a partnership or an LLC."

— CNNMoney's Cristina Alesci and Jordan Malter contributed to this report.