The Gemara states that the reason why the Torah requires one to redeem specifically the firstborn donkey and not the firstborn horse or a camel is because it is a גזירת הכתוב, a Scriptural decree. Additionally, it was the donkeys that assisted the Jews when they left Egypt, as every Jew had a minimum of ninety choice donkeys laden with silver and gold of the Egyptians.
There are a few questions that need to be addressed in this passage. First, the question of the Gemara was why donkeys are different. The answer given that it is a Scriptural decree would seem to apply to any mitzvah in the Torah, as we never really know the underlying reason for a mitzvah. How, then, did the Gemara answer the question by stating that redeeming only a donkey is a Scriptural decree? Furthermore, if the Gemara continues by offering a reason why the donkeys were singled out for this mitzvah, why does the Gemara state that it is a Scriptural Decree?
Perhaps the answer to these questions is that the Gemara is alluding to the idea that regarding redeeming the firstborn donkey it is said (Shemos 13:13)וכל פטר חמור תפדה בשה ואם לא תפדה וערפתו וכל בכור אדם בבניך תפדה, every first-issue donkey you shall redeem with a lamb or kid; if you do not redeem it, you shall axe the back of its neck. And you shall redeem every human firstborn among your sons. The literal translation of the word גזירה is to cut off. Thus, the Gemara is alluding to what occurs if one chooses not to redeem the donkey by giving the Kohen a sheep. The reason one has to axe the back of the donkey’s neck, Rashi (Ibid) writes, is because he caused the Kohen a monetary loss, so he must also incur a monetary loss. However, when he recognizes his obligation to the Kohen and redeems the donkey for the sheep, it is parallel to the second reason offered by the Gemara for redeeming specifically a donkey. The donkey aided the Jewish People when they left Egypt, so HaShem rewarded the donkey with this unique mitzvah. This reward is meant to teach us how we are required to fulfill HaShem’s mitzvos whether we understand the rationale for the mitzvos or not. HaShem required us to redeem the donkey and give the Kohen a sheep, and we must fulfill this mitzvah like any other mitzvah in the Torah.