Another interpretation: Jacob said, "So that the Egyptians not be redeemed through me, for they are likened to the donkey, as it is said, 'whose flesh is the flesh of donkeys' (Ezekiel 23:20). And I am likened to a sheep, as it is said, 'Israel is a scattered sheep' (Jeremiah 50:17). And it is written, 'and the firstling of a donkey you shall redeem with a lamb' (Exodus 34:20). So that they not be redeemed through me." Thus, "Do not bury me in Egypt."
Why Jacob Refused Burial in Egypt and the Donkey Redeemed by a Lamb
Midrash Tanchuma Buber, Vayechi 5:5
ד"א אמר יעקב שלא יפדו בי המצרים שנמשלו בחמור, שנאמר אשר בשר חמורים בשרם (יחזקאל כג כ), ואני נמשלתי בשה, שנאמר שה פזורה ישראל (ירמיה נ יז), וכתיב ופטר חמור תפדה בשה (שמות לד כ), שלא יפדו בי, הוי אל נא תקברני במצרים.