Aside: Where do you live that has a postal service where zip codes match in different cities? Sounds like someone misunderstood the point of a postal [zip] code. Or, did I misunderstand?
As a rule of thumb, sure, you can presume that zip codes follow political boundaries (city, county or state). The vast majority of times, that's the case.
However, if you do a lot of mailing, you'll discover some zip codes that cross state lines (because some remote area is actually served by a post office across the state line).
Or some area where several towns & cities map to a single "preferred" name that the USPS uses (example: Centennial, CO).
Zip codes are for the convenience of USPS and to make their life easier. The edge cases are very fuzzy & fractal.
This is more common than you would think in the U.S. ZIP codes don't always follow geopolitical boundaries. There are two cities in 57717. Some ZIP codes even cross state boundaries; USPS won't state it when you look up ZIP 42223 in their web tool, but part of it covers Tennessee. For example, the Pratt Museum is in Fort Campbell TN but has a Fort Campbell KY mailing address.
However, if you do a lot of mailing, you'll discover some zip codes that cross state lines (because some remote area is actually served by a post office across the state line).
Or some area where several towns & cities map to a single "preferred" name that the USPS uses (example: Centennial, CO).
Zip codes are for the convenience of USPS and to make their life easier. The edge cases are very fuzzy & fractal.