(Bloomberg) Microsoft Corp. has enough cash to buy LinkedIn Corp. four times over. So why is it taking out a big loan to pay for its latest purchase?

Maybe because it’ll lower the technology giant’s tax bill.

Microsoft will avoid having to pay a 35 percent tax rate to repatriate cash from overseas accounts. While it’s true that Microsoft has more than $100 billion in cash and cash equivalents, most of it is parked offshore. Bringing home any of it to fund the proposed $26.2 billion purchase, announced on Monday, would generate a tax bill.

That’s not the only benefit of borrowing. The company could also deduct interest payments, thus lowering its future U.S. tax bill. So by financing the bulk of its purchase with debt, Microsoft could legally sidestep roughly $9 billion in U.S. taxes this year, and save millions more in the years to come by using interest deductions to reduce its taxable income.

“It’s an odd world where a company is awash in cash and chooses to make the acquisition with debts because they don’t want to pay tax,” said Robert McIntyre, executive director of Citizens for Tax Justice.

The company plans to finance the acquisition “primarily with new debt,” Microsoft’s chief financial officer, Amy Hood, said during a conference call on Monday announcing the deal, without specifying an exact amount it expects to borrow. A Microsoft spokesman didn’t immediately respond to a request for comment.

Companies are always deciding how to finance themselves and prefer debt when rates are exceedingly low, as they are now. With its latest plan, Microsoft joins a procession of cash-rich U.S. companies that have in recent years relied on leverage to sidestep U.S. taxes. In 2015, Apple, with more than $180 billion overseas, borrowed $6.5 billion to pay shareholders a dividend.

Many chief executive officers and business analysts say the strategy amounts to both good corporate governance and common sense. Apple CEO Tim Cook famously said last year that it was “crap” to criticize his company for borrowing at low rates to avoid paying 40 percent in combined federal and local taxes.

Avoiding Taxes

But financing the LinkedIn purchase with debt could leave Microsoft in a spot—rich abroad and strapped in the U.S. On Monday, Moody’s Investors Service placed Microsoft’s Aaa senior unsecured rating under review for downgrade, citing the company’s debt and overseas cash hoard as factors.

Microsoft is already committed to pay the final $10 billion of a $40 billion share buyback program this year. But the company has only $3 billion in cash in the U.S. and would likely have to borrow to pay for the buyback, said Richard J. Lane, a senior analyst for Moody’s. The decision to add another $20 billion plus of debt to buy LinkedIn could "contribute to ratings pressure,” Lane said.

With 97 percent of its cash overseas, “Microsoft’s ability to support its existing capital allocation program without further debt is limited,” the Moody’s report noted. S&P Global Ratings, by contrast, affirmed Microsoft’s AAA rating on Monday.

‘Tax-Free Repatriation’

Microsoft’s borrowing plan is another example of the way the U.S. tax code encourages corporations to use bookkeeping maneuvers to avoid taxes, representatives for tax fairness groups and other tax experts said Monday.

Under the current tax policy, Microsoft’s borrowing was tantamount to “a tax-free repatriation,” said Edward Kleinbard, a tax expert and professor of law and business at University of Southern California.

“The offshore money continues to sit, invested in portfolio assets, earning a rate of return—and the new borrowing then incurs an income expense, so the two offset each other,” said Kleinbard, a former chief of staff for the congressional Joint Committee on Taxation. “It means a somewhat bloated balance sheet, but that cosmetic blemish is a lot less costly than writing out a big check to the Treasury.”

Glaring Idiosyncrasy

Such convoluted accounting measures are the result of a glaring idiosyncrasy in the U.S. corporate tax code: The U.S. taxes its multinationals on profits earned anywhere around the globe, but only after the money is brought home. That might explain why companies with big offshore stores find it difficult to use their cash. By contrast, almost every other government exempts foreign profits from taxes at home.

These tax rules have prompted U.S.-based corporations to hoard more than $2 trillion in earnings in their foreign subsidiaries, according to a Bloomberg analysis, an amount that would result in a tax bill of more than $600 billion if it were returned home.

Adding to the counterintuitive nature of borrowing by cash-rich corporations is this: Although the untaxed money is technically controlled by the foreign subsidiaries of U.S. multinationals, much of it is held in U.S. banks and investment accounts. In Microsoft’s most recent quarterly report, the company reported $102.8 billion in untaxed profits controlled by its offshore subsidiaries, 81 percent of which was held in U.S. government securities.

From the time President Barack Obama took office in 2009 through the end of 2015, the cash hoards held by U.S. multinationals roughly doubled to $2.4 trillion, according to a study of corporate filings by Citizens for Tax Justice. Pfizer reported more than $193 billion in unrepatriated profits at the end of 2015. Apple had more than $200 billion; General Electric: $104 billion, Google: $58 billion and Goldman Sachs: $28 billion.

Many U.S. multinationals, particularly in the technology and pharmaceutical industries, have been lobbying federal officials for years to enact a so-called “repatriation holiday,” allowing them to bring money home at a rate far below the 35 percent corporate tax. A lower rate would allow them to return the money and use it to hire and invest in the U.S., the companies have asserted.

That’s not what happened in 2005, when Congress and the Bush administration temporarily lowered the tax rate on repatriated corporate profits to 5.25 percent from 35 percent. More than 800 companies availed themselves of the program, bringing home $300 billion.

But 92 percent of that money was used for share buybacks and executive bonuses, according to a subsequent study by the National Bureau of Economic Research, and some of the companies that reaped the biggest tax savings actually closed plants and laid off tens of thousands of workers in the U.S.

Divided Lawmakers

With Congress deeply divided and with a contentious presidential race under way, the prospects of any major tax code changes this year are minuscule, according to tax experts. By borrowing to pay for its LinkedIn purchase, Microsoft preserves its option to take advantage of any repatriation tax breaks that might be enacted by the next Congress and president.

“I believe they are betting that there will be a better way to get the earnings home in the future under most plausible expected tax reforms,” said Kimberly Clausing, an economics professor at Reed College who has written extensively about offshore corporate policy.