Presented are automated “class-flexible” drug dispensing systems, which include an automated drug dispensing machine. The automated machine has a multiplicity of drug cartridges and dispenses appropriate drugs on command from cartridges to fill a prescription. The system also has a user interface to input prescription information and class of trade information for each particular prescription to be filled. Further, it has an electronic storage medium with drug identifying information for the drug in each of the multiplicity of cartridges and the inventory of the drug in each cartridge. In addition, the system includes an electronic billing system that includes prescription information and the drug “class of trade” information. The billing system uses this information to create an electronic billing entry. Also presented are drug distribution systems to reduce overall drug costs from manufacturer to end user.