How Warren Buffett and Don Graham are saving $675 million in taxes

April 9, 2014, 1:00 PM UTC

FORTUNE — Happy Tax Season! In honor of our annual spring ritual, let me show you how utterly bizarre the American tax system can be, using a recent deal between two well-known outfits to illustrate my point. The deal involves Don Graham’s Graham Holdings (GHC) (formerly the Washington Post Co.) and Warren Buffett’s Berkshire Hathaway (BRKA), which are doing what’s known in the tax biz as a cash-rich split-off. It’s a way that companies can dispose of holdings on which they have big gains and emerge with cash without technically selling anything, thus incurring no tax bill. Doesn’t that sound like fun?

Why am I amused by this, rather than enraged, the way I am by companies like Apple (APPL), which call themselves American but invent repellent (albeit not illegal) ways to artificially suck earnings out of the U.S. via offshore subsidiaries that don’t have to pay any tax anywhere? Because cash-rich split-offs are specifically allowed by the Internal Revenue Code. Graham and Berkshire aren’t pushing boundaries; they’re using something that Congress has specifically allowed. It’s absurd, but it’s permissible under the tax code provisions that govern corporate spinoffs, such as the imminent non-game-playing separation of my employer, Time Inc., from Time Warner (TWX).

MORE: The proof is in the data – time to raise the U.S. minimum wage

Graham and Berkshire, which both declined to talk to me, stand to save a total of about $675 million in federal and state income taxes by going the cash-rich split-off route. Graham is trading cash, Berkshire stock that it owns, and a TV station for most of Berkshire’s 23% stake in Graham. (Disclosure alert: I own shares in both companies, and am a pensioner of Graham.)

Cash-rich split-offs have become increasingly popular since 2003, when the Janus mutual fund management company did the first one, with DST Systems (DST), a data-processing company in which it owned a big stake. Letting companies split into separate parts, tax-free, is a long-standing, rational practice. But now some spinoffs have become tax-avoidance vehicles, in which a business is included merely to make the deal tax-free. For example, in 2006, Time Warner traded cash plus the Atlanta Braves baseball team to famously taxophobic Liberty Media (LMCA) for Time Warner stock that Liberty owned. The deal was tax-free for both firms.

Here’s how a cash-rich split-off works. Company A puts cash or other “investment assets” plus a business into a subsidiary that it then swaps tax-free to Company B in return for B’s holding of A’s stock. Graham is ponying up $400,282,183 worth of Berkshire stock that it owns, plus $327,717,817 in cash, for a total of $728 million. It’s also tossing in WPLG, a Miami TV station that the deal values at $364 million — exactly one-third of the $1.092 billion that Graham will give Berkshire. (You’ll see in a bit why I’m being so precise.)

MORE: The leisure revolution that never came

In return, Graham will get 1,625,747 Graham shares that Berkshire owns. As of March 7, the date Berkshire used in an SEC filing, that stock was worth about $1.144 billion.

Had Berkshire sold those Graham shares, which cost it about $10 million 40 years ago, for $1.092 billion, it would owe about $425 million in federal and state capital gains taxes. Had Graham sold the Berkshire stock (estimated cost: $130 million) for $400 million, and the TV station (purchased in 1969 for around $15 million) for $364 million, it would owe about $250 million in taxes. Call the total tax savings $675 million. Plus Graham receives a bonus typical of deals like this and gets back shares worth about $50 million more than the assets it’s shelling out.

Tax expert Bob Willens of Robert Willens LLC says that Berkshire had best get Graham to reduce its cash payment by $1 when the deal closes. That’s because the tax code says the operating business has to be “somewhat more than a third” of the total price, not the exact third indicated in the Berkshire filing. Willens, with a chuckle, says he won’t bill anyone for the advice. And that will do it. Many happy returns to you and yours.

Reporter associate: Marty Jones

This story is from the April 28, 2014 issue of Fortune