For the source text click/tap here: Shekalim 4
To download, click/tap here: PDF
The Gemara cites an additional reason for the obligation to give a half-shekel: It atones for the sin of the sale of Joseph.
First, it introduces this topic. Rabbi Berekhya and Rabbi Levi said in the name of Rabbi Shimon ben Lakish: Since the sons of Jacob sold Joseph, the firstborn of Rachel, for twenty silver dinar, the nation was commanded that each of them must redeem his firstborn son with twenty silver dinar, which is five sela, as there are four dinar in a sela.
This leads us eventually to the Eleh Ezkera Kina on Tisha B'Av and its connection of the 10 Martyrs as atonement for the Sale of Joseph.