Jim Cramer: This looks like a 'legal scam'

Close look at Allergan bid

The collaboration between activist investor Bill Ackman and Valeant Pharmaceuticals to bid for botox producer Allergan reveals the "legal scam" that the U.S. tax code has become, CNBC's Jim Cramer said Tuesday.

Ackman and Valeant have proposed buying Allergan in a cash-and-stock deal worth about $45.6 billion. Critics of Valeant say the Canadian company's generous tax rate represents its most attractive asset. Valeant pays a super-low tax rate because of its Bermuda tax inversion, and it can repatriate profits from foreign sources.

"It's a legal scam," Cramer said on "Squawk on the Street." "What's legal is often far worse than than what's illegal."

Read More Valeant, Ackman propose deal with Allergan

Though he lauded the business potential of the proposed deal, Cramer called tax inversion schemes "arbitrage."

"Valeant is a roll-up," Cramer said. "There's a lot of people who don't like Valeant. They keep buying and buying. ... We have seen this over and over again. The tax code is such a joke. I don't mind saying that."

Tax inversion occurs when U.S. companies—through mergers, acquisitions or sales— incorporate their businesses overseas to take advantage of lower taxes.

The Associated Press and CNBC's David Faber contributed reporting to this report.

Disclosure: Cramer's charitable trust doesn't own shares of Allergan or Valeant.