Our sages, of blessed memory, said [at the end of Bava Kamma] that for this reason one may not purchase wool, milk, or kids from shepherds. However, one may purchase milk and cheese from them in the wilderness, but not in a settled area, for in the wilderness it is likely that the owners commanded them to sell because it is a great burden to bring them to a settled area. But wool and kids are brought to a settled area, and one may not purchase them in the wilderness, for their intention is certainly to steal from the owners. It is permitted to purchase from shepherds four sheep from a small flock or five from a large flock, for the presumption is not that it is stolen, since the owners would notice such a number and he cannot steal them. Similarly, regarding shearings of wool, it is permitted to purchase the shearings of four sheep from a small flock and five from a large flock for this reason. The general rule of the matter: anything the shepherd sells, if the owner of the flock would notice its absence when he sells it, it is permitted to purchase it, for it is not within his power to steal it; and if not, it is forbidden, even though one does not know for certain that the shepherd's intention is to steal, for ordinary shepherds are suspected of this. Even if the shepherd also has sheep of his own, one should not buy from him that which is suspected of being stolen. This is not similar to what was written in siman 369, that it is permitted to benefit from a gazlan from his own property when he has a small amount that is not stolen; that applies to benefiting from his property, but not to purchasing the item [the Maggid Mishneh, chapter 5 of Gezelah, halacha 8]. This follows the version in the Gemara [Bava Kamma 119a]: "From when is it permitted to benefit from a gazlan?" and this is the version of the Rambam and the Rosh. And even according to the version of the Rif, "to collect from him," one could say this. However, before us the version is "to purchase from him," and it is impossible to make such a distinction; one must say that it deals with a case where the shepherd has no sheep of his own at all. There are those who wish to distinguish between a ganav and a gazlan, but it does not appear so [as per what the Sma wrote, and what the Tur and Shulchan Aruch wrote, "if the majority of that thing," its meaning is not regarding this individual but regarding the general category of the thing, and so it appears from the Kesef Mishneh at the beginning of chapter 6 of Geneivah, see there].
וחז"ל אמרו [שילהי ב"ק] דלפיכך אין לוקחים מהרועים צמר או חלב או גדיים אבל לוקחים מהם חלב וגבינה במדבר אבל לא בישוב דבמדבר קרוב הדבר שהבעלים צוו להם למכור מפני שטורח מרובה הוא להביאן לישוב אבל צמר וגדיים מביאים לישוב ואין לוקחין מהם במדבר דודאי כוונתם לגנוב מהבעלים ומותר ליקח מהרועים ד' צאן מעדר קטן או חמשה מעדר גדול שאין חזקתו שהוא גנוב דמספר כזה מרגישים בו הבעלים ואינו יכול לגנבן וכן בגיזות של צמר מותר ליקח גיזות ד' צאן מעדר קטן וחמשה מעדר גדול מטעם זה כללו של דבר כל שהרועה מוכר אם בעל הצאן מרגיש בחסרונו כשימכור מותר ללוקחו דאין ביכלתו לגנוב ואם לאו אסור אע"פ שאינו יודע בודאי שכוונת הרועה לגנוב דסתם רועים חשודים על זה ואפי' יש להרועה גם צאן עצמו אין לקנות ממנו מה שחשוד לגנוב ולא דמי למ"ש בסימן שס"ט דמותר ליהנות מגזלן מממונו כשיש לו מעט שאינו גזול זהו לענין ליהנות מממונו אבל לא לענין לקנות הדבר [הה"מ פ"ה מגזלה ה"ח] וזהו לפי הגירסא בגמ' [ב"ק קיט.] גזלן מאימתי מותר ליהנות ממנו וזהו גירסת הרמב"ם והרא"ש וכן לגירסת הרי"ף לגבות ממנו י"ל כן אבל לפנינו הגירסא לקנות הימנו א"א לחלק כן וצ"ל דמיירי שאין להרועה צאן משלו כלל ויש שרוצים לחלק בין גנב לגזלן ולא משמע כן [כפמ"ש כ"מ מהסמ"ע ומ"ש הטוש"ע אם רוב אותו דבר אין פירושו על האיש הזה אלא על כלל הדבר וכ"מ מהכ"מ רפ"ו מגניבה ע"ש]: