The bars and pubs pay a deposit for the kegs, the same way we do at retailers, and receive a credit once they turn the empties back in, that they use as the deposit on the next round of kegs.
The bars don't ever own the kegs, they are just leasing them, just like we do. Same thing with the corny kegs they use for their soda. At no point does the bar own the keg, they have to turn them back over to the distributor. Also, just like us, it is part of their contract that they have to turn the kegs back in, so keeping them or selling them to YOU is called STEALING from the distributor!
Think about it, if the bars BOUGHT the kegs, then #1, what would the bar/pub do with 500 or whatever empty kegs every year. #2, the distributor would have to continuously keep buying brand new kegs. #3, the bar would be better off just buying a keg retail, because they wouldn't have to pay for the cost of the keg.
Anyway, bottom line, bars and pubs don't buy kegs.
The only legal way to buy kegs is from the manufacturers or distributors.