Numbers 8:16

For they are wholly given unto me from among the children of Israel; instead of such as open every womb, even instead of the firstborn of all the children of Israel, have I taken them unto me.

The Levites were wholly given to God from among the children of Israel to carry on the work of the sanctuary in place of the firstborn. The firstborn of Israel belonged to God because they had been preserved when the firstborn of Egypt perished. Even so, without the atoning sacrifice they too had been exposed to death, and for that deliverance they were His by special right. The Levites were therefore taken as their substitutes in sacred service, while every firstborn son still had to be redeemed by a stated payment.