Yosef tells his family to say they're shepherds because that's taboo to Egypt:
you must say, 'We and our fathers have dealt in livestock all our lives'. You will then be able to settle in the Goshen district, since all shepherds are taboo in Egypt.' (Gen 46:34)
Commentary from bible.ort.org says about this:
Some say that this was because sheep were sacred to Egyptians, and hence, those who raised them for food were considered an abomination (Rashi; see Genesis 43:32). Others say that the Egyptians were vegetarians (Ibn Ezra). If this was after the Hyksos were driven out, it might have been a reaction against the Hyksos, who were 'shepherd kings' (Josephus, Contra Apion 1:14). Others say that it was a social taboo (Rashbam).
Ok, Egyptians have a problem with shepherds. Clear enough, or so it seems.
But when Yosef is managing the famine later the Egyptians pledge their livestock, and sheep are specifically mentioned:
They brought their livestock to Joseph, and Joseph gave them bread in exchange for horses, flocks of sheep, herds of cattle, and donkeys. He saw them through that year with bread in exchange for all their livestock. (47:17)
So we learn from this that the Egyptians kept sheep. So what does it mean that there was a taboo against shepherds?
In today's parsha chat someone suggested that the Egyptians didn't eat their sheep but might have gotten wool and milk from them, and we speculated that maybe the word "shepherd" specifically applies to herding food animals. Did that distinction matter historically and would there have been separate terms for it? Did farmers of that time have the practice of fattening up livestock for slaughter, and if you're not going to eat them you feed/graze/herd them differently?
So my question is: if shepherds were taboo in Egypt, then how to we explain the Egyptian flocks of sheep?