חלב בהמה וחיה טמאה או טריפה וצירה וכו' אסורים פשוט בפ"ק דבכורות (ז.) דחלב בהמה טמאה וצירה אסור ודין חלב טריפה פשוט בפרק כ"ה (קטז:) ובפרק בהמה המקשה (חולין סט.) וכ"כ הרי"ף והרא"ש בפרק אלו טריפות וכתב הרמב"ם בפ"ג מהמ"ח שאע"פ שחלב בהמה טמאה אסור מן התורה אין לוקין עליו שנאמר מבשרם לא תאכלו על הבשר הוא לוקה ואינו לוקה על החלב: Milk from a non-kosher or terefah animal, and its whey, etc., are forbidden. This is explicit in the first chapter of Bechorot (7a) that milk from a non-kosher animal and its whey are prohibited. The prohibition of milk from a terefah animal is clear in the 25th chapter (116b) and in the chapter "Behemah HaMakshah" (Chullin 69a). Similarly, the Rif and the Rosh wrote this in the chapter "Elu Treifot."
The Rambam wrote in the third chapter of Ma'achalot Assurot that although milk from a non-kosher animal is forbidden by Torah law, one does not receive lashes for it, as it is stated, "You shall not eat of their flesh"—it is the flesh for which one is liable to lashes, but not the milk.