Things have changed a little, but during the time that compounding was explicitly allowed, the licensed pharmacies were buying from FDA approved manufacturers, sometimes in China, and sometimes the same manufacturers who also do contract manufacturing for Lilly.

Today ... who knows? It might just be the same gray market stuff us plebes can get.