If successful, the deal could be the largest this year. Allergan has a market value of about $113 billion.

It could also offer Pfizer something the US company has been after for a while – a way to slash its tax bill.

It could do so with a so-called tax inversion, a legal move in which a US company merges with a foreign-domiciled company to shift its address to a country with a lower tax rate.

In this case it would have Pfizer moving its tax domicile — not necessarily its management headquarters — to Ireland, where Allergan is based.

Allergan and Pfizer on Wednesday said only that they were in "preliminary friendly discussions." They noted that there was no certainty they would reach a deal, and they declined to comment on potential terms.

For a deal to become an inversion, it has to be structured in a specific way — primarily the acquirer has to pay for part of the deal with its stock.

Buyers in inversions typically take pains to explain that avoiding taxes isn't their only — or even primary —rationale for a deal, but it's no secret that Pfizer has been looking for an inversion target.

Pfizer CEO Ian Read has repeatedly said tax is a competitive challenge for US companies.

Here's what he said on the company's earnings call last week:

The employees of Pfizer want to have a robust successful company in the future. Their jobs and their careers depend upon it ... To be successful in the future, we need to have a competitive tax rate. So that is why it's an important issue for us.

In May 2014, Pfizer unsuccessfully tried to buy the British drugmaker AstraZeneca, again partly for the tax benefits of moving overseas.

Pfizer eventually walked away from that deal, after AstraZeneca fended off the bid and UK politicians expressed worry over it.

Bloomberg analysts Elizabeth Krutoholow and Curt Wanek explained what moving to Ireland would do for Pfizer:

Allergan's tax domicile is in Ireland, which provides one of the most attractive havens for tax-inverted deals, given the country's low corporate tax rate of 12.5%. This could double the amount of money saved on taxes, given Pfizer's current effective tax rate is 25%. This would allow Pfizer a better option for cash already held overseas instead of repatriation.

Tax inversions were common in the 1990s but became a hot topic two years ago when numerous high-profile inversions — and attempts — took place.

They are particularly popular among drug companies. Actavis, which later acquired Allergan and kept the name, inverted to Ireland when it acquired Warner Chilcott in 2013. Valeant Pharmaceuticals acquired Biovail in 2010 to move to Canada.

But it's not just drugmakers. Burger King merged with the Canadian food chain Tim Hortons in 2014 and moved there.

Activity cooled off after the US Treasury introduced a regulation in September last year that was designed to make it harder to pull off an inversion.

If the Allergan-Pfizer deal goes through and is structured as an inversion, it would be the largest such deal on record.