Parashas Bamidbar · Passuk 3:47
take five shekels per head—take this by the sanctuary weight, twenty gerahs to the shekel—
Chabad.org — English translation + Rashi
Source: Bechoros 5a.
English: “And you shall take five\ldots” — How did he do it? He brought 22,000 lots and wrote on them “son of Levi,” and on 273 he wrote “five shekels.”
In context: The classic account of the lottery by which the excess firstborn were designated for the five-shekel redemption.
Custom
Chazal describe the lot procedure used to select which firstborn paid the five shekels.