You're missing a huuuuge chunk of important information here, which is not unexpected given that you have very limited knowledge of what real food animal medicine is like. There are many reasons why a farmer buys his/her own abx and administers themselves under a vet's direction. There is truly too much discussion here to be had adequately via a forum. We rounded on stuff similar to this for like 3 hours on a slow day during my farms rotation.
1. Food animal vets often can't make reasonable profit off of selling abx/drugs like a SA vet can. Farmers have a hard 'cost line' they adhere to-if they go over by a dollar, they are losing more money than the animal will make at market. A bottle of LA-200 runs $70 or so right now. That means the vet has to mark that up by however much they feel is necessary for them to get an adequate revenue in (SA clinics I've worked for typically do anywhere from 50-200% depending on the true cost). Depending on what you're treating/the weight of the animal, you may be going through 40+ml of the bottle per day per animal. You can see that every dollar the farmer can save here would matter in terms of whether or not they keep the animal alive to treat vs. just euthanizing or sending to market (if the disease present wouldn't condemn the carcass). Yes, there are strict rules/guidelines as to whether any animal presented to a slaughterhouse will actually be slaughtered for meat.
2. If a vet is the only one keeping/selling the abx, can you imagine how much of their time/money would be lost by going to a 100 head (which is considered a small operation) to give antibiotics during an outbreak of something? It would be several hours, if not an entire day, to run a sizable beef herd through the chutes just for meds, and that's with help and experienced cattle movers. Dairy would go faster assuming you're not out in pasture chasing/keeping track so you don't double dose or miss a cow. Also keep in mind travel time, some ambulatory calls can be up to 2 hours away in my experience. Also make a note that small-scale operations are disappearing, and farmers are dealing with more and more large-scale operations. The amount a vet would have to charge for selling the drug as well as making sure it is given according to their direction (by giving it themselves) would be astronomical in terms of what farmers can afford/are willing to pay for. A vet can't physically carry around this much drug on their truck, either. You tell the farmer to go get enough bottles from the farm store to last them for however long, and you come back in a week or so to reassess. The vet doesn't even stick around to give the herd the first dose.
3. Farmer's don't just go to the farm supply store and say 'Oh, this drug looks good, let's go with this.' They were told directly by a vet what to get. In food animal med, you can't just decide to treat a disease with whatever you want/whatever route/however often. There are legally enforced rules/regulations. Like mentioned, people that get caught are slammed with so many fines that operations are shut down out of bankruptcy over it. It isn't always intentional (a farm hand might make a mistake, for example), but when you're caught, you're held accountable. Sure, some farmers decide they think they know what disease process is going on and decide to go pick up a bottle based on that, but I was the student on several cases the other week with 'Well doc, we treated with this because we thought it was x but it didn't work.' 'Well, it's not x, that's why it didn't work.' So the farmer learns that if they would have called the vet in the first place, they would have spent less. Sometimes they guess correctly, often they don't.
Also, if a farmer intentionally gives abx illegally, they do this knowing they risk sabotaging their own reputation. Farming is a small world.
And yes, you can get some human medications online pretty easily. It doesn't take much searching. Some require a written rx to be faxed/mailed, but that's not that big of a hurdle to overcome if you're that determined.