In the U.S., a police officer only has powers of arrest within his/her jurisdiction. In a small city like Salem, Massachusetts, a Salem Police officer has powers of arrest anywhere within the city of Salem. A Massachusetts State Trooper has powers of arrest anywhere within the state of Massachusetts. Its usually the State Troopers that catch us speeding on the highway because they aren't restricted to an individual town. (Ooops did I say that out loud?

) In a large city such as Boston, Mass. police officers are assigned to particular precints (section of the city) and their powers of arrest may also be limited to that precint.
Each state is divided up in to counties. There is a modicum of goverment at the county level, usually just enough to manage shared resources for the towns/cities wiithin the county.
A Sheriff is both a political job and a law enforcement job. The Sheriff's office is largely responsible for overseeing the corrections system within the county. The Sheriff also performs law enforcement duties for the parts of their county that have not been incorporated in to towns (if they exist). This is seen more in the rural parts of the country, such as the south and west....and less so in the Northeast where everything is rather crowded.
That is why Sheriff Joe has the say he does over the Maricopa County Jail, because as Sheriff, he oversees the corrections system for the county.
Confused yet?