Iran signed the NPT.
The NPT did not exist at the time of the US developing nuclear weapons, and it explicitly allows US (and other pre-existing nuclear powers') weapons.
Israel, like India and Pakistan, simply never signed it, forgoing the international nuclear technology market as a consequence but also avoiding a treaty obligation not to develop them.
That was before the revolution. The revolutionary government still honored the deal, but that's been obviously a losing move for a while. The whole Middle East recognizes that, just look at how many countries Pakistan has sharing agreements with recently.