I’ve wondered if each plague acted as a punishment for the Egyptians, at least the common people, similar to that of a proper punishment for a Jewish person’s misdeed leaving them pure of that sin by the fact that they had to experience a punishment. Obviously this is only the case for sins that allow for corrective actions. In contrast, I don’t recall Sodom and Gemorrah and the other cites of the plain, having plagues to grant them a punishment before their final downfall and if not, why not? My understanding is the Pharoah had the opportunity for life and perhaps elevation until the fifth plague or so after we he was just to be used for HaShem’s uses before his final demise.
Shalom Ze’ev, The Rambam (Milachim 9, 14), explains that when a population accepts the evil behavior of their king without protest, judgement or overthrowing him, they are considered guilty, as well. Accordingly, the Egyptians should have protested and pressured Pharoh to free the enslaved Jews, as they eventually did, from the beginning. Regarding the cities around Sodom, like Pharoh, after misusing their free will to do such atrocities, eventually they were punished (one cannot expect patience and tolerance forever, especially when it come at the expense of others!). Justice is not only true and moral, but it serves as a deterrent to others as well, and that’s why it’s written up in the Torah. With Love of Israel, Rabbi Ari Shvat