The prohibition, which is listed in the Mishnah tractate titled Avodah Zarah, allows for benefit to be derived from such milk, while drinking it is forbidden out of fear that a non-kosher animal's milk was mixed into the kosher milk.
The Mishnah tractate Avodah Zarah's prohibition on consuming milk with potential contamination, while allowing for its use for other purposes, highlights the importance of ensuring kosher practices.