As a rule peace officers in the Old West weren’t held to the high standards they are today. It wasn’t unusual to rough up a suspect in order to get a confession; a lawyer didn’t have to be present; and a suspect didn’t have to have his rights read to him. In short public servants, including lawmen, weren’t subject to the public scrutiny they are today.
Other than keeping the peace, one of the sheriff’s duties was to keep the streets clean from dead cats and dogs, take care of the trash and sweep up the horse manure. His main one, next to keeping the peace, was that of tax collector. Collecting taxes was a nice supplement to a sheriff’s meager salary as he got to keep a percentage. And you’re right it was custom for the sheriff to buy a round for the local imbibers. I don’t know what protocol was at the houses of prostitution. Let’s hope the sheriff wasn’t expected to buy rounds for that too.
When future Arizona Senator Carl Hayden was Sheriff of Maricopa County, around 1910, he quickly realized it wasn’t cost effective to collect taxes at the usual time on Saturday afternoon as large numbers of freeloaders always gathered on saloon row in Phoenix. He started making his rounds early in the morning when the saloons were just opening and the boys were still sleeping off the previous night’s drinking.