Oh, Hollywood—you are selling nothing but a pack of lies! You try to get us to buy the idea that a prison is in Maine, when really everything was shot in Ohio. Curse you, O deceitful one!
Yes, it's true. Through the miracle of movie magic, the producers were able to make Ohio look like Maine, and you thought the technology behind Gollum was incredible.
Fine, so it probably didn't bother you, and you probably couldn't even tell the difference. However, there it is anyway. It was at the Ohio State Reformatory in Mansfield, OH that most of the prison scenes were shot, with various other scenes (downtown, the hayfield in "Buxton," etc.) being filmed in the surrounding areas.
Shot on film, the movie did a masterful job of creating the feeling that Shawshank was located in cold, gray and dreary New England, when it was actually shot in the cold, gray and dreary Midwest. Sorry if this blows your mind, but the Zihuatanejo scene wasn't shot in Mexico either, but rather on a beach in the Caribbean.
The actual Zihuatanejo has since been closed down due to public safety concerns arising from a super-high level of pollution in the surrounding ocean. You can try dipping a toe in the water there if you're feeling impulsive, but chances are good that, if you do, you might get busy dying.