To contrast, we aren't officially at war with Iran
Well, we might not be "officially at war" with Iran, but Iran (directly, and through its proxies) is fighting and hitting AMERICAN targets, and vice versa.
Even if Raisi wouldn't be responsible for one American life, he is widely known as "The Butcher of Teheran" and responsible for mass killing of his own people (as well as people in other countries).
Protocol shouldn't allow condolences after the death of such monsters (the only difference regarding Stalin, was that at some point he became an ally and helped defeat the Nazis).
And while we're mentioning Stalin, are you aware of the PUBLIC mourning that occurred in Israel when he dropped dead?