Parashas Ki Sisa · Passuk 30:12
Chabad.org — English translation + Rashi
Torah Temimah points to Mechilta (Mishpatim 21:30).
English: It was taught: Rabbi Yishmael says: Come and see the mercy of the Holy One, Blessed be He, upon flesh and blood — that a person can redeem himself with money from Heaven, as it is said: “When you take a census of the children of Israel… they shall give each a ransom for his soul.”
Derash — the half-shekel as a ransom that allows a person to redeem himself before Heaven.
Hashem’s mercy is shown in that a person may redeem his soul with money (the census half-shekel) rather than being subject to plague.