Pharmaceutical companies do some creative things to try to extend their patents, but Allergan may have just taken the cake.

Allergan said Friday that it transferred all the patents for its billion-dollar eye drug Restasis to the Saint Regis Mohawk Tribe, which then granted the drug giant back an exclusive license.

For its trouble, the tribe will get $13.75 million from Allergan, plus potentially $15 million in annual royalties.

Why? Restasis is facing multiple patent challenges, including some under a system known as inter partes review, or IPR.

The tribe, Allergan says, holds sovereign immunity against these kinds of legal challenges, and thus is now filing a motion to dismiss the IPR.

The result: Allergan potentially gets a legal challenge off its back.

"I believe it's novel," Allergan CEO Brent Saunders told CNBC in a telephone interview after the agreement was announced.

"The actions today really allow us to focus the defense of the Restasis patents in the federal court system and avoid the double jeopardy created by the IPR system," Saunders said.

Allergan's stock rose 1.8 percent in trading Friday on the heels of the news.