Evidently whoever was teaching Police Administration when I took it was wrong.
That is what always happens when you try to take the general to the specific.
In General, the 'Sheriff" is the chief law enforecement officer of the county and therefore, usually runs the county jail.
In NYC's case, there are actually 5 counties in one city, so trying to apply the usual rules will always get you into trouble. NYC makes up its own rules.
The title "Sheriff" is being used and the closest it comes to the historic use of term is that the office functions are the enforement arm for the civil courts. (Think Sheriff of Nottingham not Andy Taylor)
When NYC Finance wins a Civil Judgement in Court, they need guys with guns and badges to collect.
I take it they are not popular. You may hate the police, but they are also the ones to come when you get hurt or you are the victim. The only "victim" the sheriff helps is NYC itself.