Yes, 'The Town' is based on a true story. It's loosely based on Chuck Hogan's novel 'Prince of Thieves', which in turn was inspired by real - life events in Charlestown, a neighborhood in Boston known for its high crime rate, especially bank robberies.
The town wasn't a true story. It was likely a product of the author's creativity and storytelling skills, designed to engage and entertain readers/viewers with an imagined setting and events.