Immunity and impunity are similar, but not identical, in both meaning and spelling. Immunity relates to protection from punishment, duty, liability or illness.
Telecommunications companies have been granted legal immunity for cooperating in warrantless domestic wiretapping because it was ordered by the president.
Impunity is narrower and refers only to protection from punishment.
For decades, the cartels operated with impunity, unchallenged by corrupt cops.