U.S. stocks are roughly unchanged in early Thursday afternoon trading, with the Dow Jones Industrial Average (^DJI 0.69%) and the S&P 500 (^GSPC 1.20%) down 0.08% and 0.13%, respectively, at 1:25 p.m. EST.

Berkshire Hathaway is expected to record quarterly profits after tomorrow's market close thanks to a $7 billion pre-tax gain on Berkshire's stake in Kraft Heinz Co, the food and beverage group that resulted from the merger of H.J. Heinz and Kraft Foods Group. Here's how that gain arose.

The merger was announced in March and closed on July 2. On the eve of the closing, Berkshire was Heinz's largest common equity shareholder, with a 52.5% stake (Berkshire also owns $8 billion of preferred shares that pay a 9% dividend).

Post-closing, Berkshire owns 26.9% of Kraft Heinz and remains the largest shareholder of the new company, just ahead of its partner, 3G Capital, which owns 24.2% (giving it a combined majority stake of 51%).

Berkshire accounts for this investment using the "equity method" (use of this method is typical for a voting stake of 20% to 50%, which suggests "significant influence" over the investee).

In accordance with this method, Berkshire includes its proportionate shares of Kraft Heinz earnings in its income statement in interest, dividend, and other investment income under "Insurance and Other." Dividends on the preferred shares are treated the same way.

That is not the source of the $7 billion pre-tax gain, however. As Berkshire explained in its second-quarter report:

As previously discussed, the issuance of new common stock by Kraft Heinz for Kraft common stock reduced our ownership of Kraft Heinz from approximately 52.5% to 26.9%. Under the equity method of accounting, the issuance of shares by an investee is accounted for by the investor as if the investor had sold a proportionate share of its investment.

As a result, we currently expect to record a non-cash pre-tax holding gain of approximately $7 billion in the third quarter of 2015, representing the excess of the fair value of new Kraft Heinz common stock issued for Kraft common stock over our carrying value associated with the reduction in our ownership of Kraft Heinz.

In other words, the $7 billion pre-tax gain corresponds to Berkshire recognizing -- not realizing, the distinction is crucial -- the capital gain on roughly half its original investment in H.J. Heinz. It's a one-time gain, yes, but happily, including its proportion of Kraft Heinz earnings in Berkshire's income statement will be a recurring phenomenon. Furthermore, we can expect the Kraft Heinz stake to continue to accrue value under 3G Capital's direction.

Separately, Kraft Heinz announced yesterday that it would close seven factories and eliminate 2,600 jobs, or nearly 6% of its workforce. Those job losses add to the 2,500 planned job cuts announced in August.

Kraft Heinz, which effectively answers to the same Brazilian investors who brought you the "Megabrew" merger of AB InBev and SAB Miller, has promised a $1.5 billion annual reduction in costs by the end of 2017.

3G Capital's roll-up strategy, which consists of a combination of organic growth, successive acquisitions, and draconian cost-consciousness, is tried and tested. It's that strategy that has enabled them to conquer the global beer market. Kraft Heinz is only the fifth largest food group in the world -- there's still room to run for Berkshire and 3G Capital.