After catching him desecrate a undried sidewalk, Marge lectures Bart on the importance of town pride, who realizes how wonderful it is living in Springfield. However, Bart also becomes upset with anti-Springfield sentiments coming from the neighboring town of Shelbyville. Grampa explains that this rivalry can be traced back to the establishment of the two towns. This occurred when the founders Jebediah Springfield and Shelbyville Manhattan discovered they had irreconcilable differences regarding their visions for a perfect town, Springfield favoring promotion of chastity and Shelbyville advocating incestuous marriages between cousins, having somehow misunderstood Jebediah's intentions and believed that was the whole point of the settlement. The settlers split up into two groups, and the foundation for the rivalry is created.
The next day, Springfield's lemon tree is stolen by a gang of boys from Shelbyville. Taking his town pride to heart and swearing to keep it, Bart leads Milhouse, Nelson, Martin, Todd, and Database into Shelbyville to search for the tree and bring it back to Springfield. The group splits up, with Milhouse befriending a local blue-haired boy with the same name, and Martin using Nelson for protection while interogating a younger boy at a lemonade stand. Bart goes undercover and infiltrates the children of Shelbyville that stole the tree by disguising himself. The group is led by a local boy who is similar to Bart himself in both appearance and attitude. His cover is eventually exposed after he sabotages an attempt to write "Springfield Sucks" on the mountainside, and escapes via skateboard while being chased by his Shelbyville doppleganger, racing through Shelbyville and revealing many eerily similar locations such as a convenience store owned by an Asian immigrant, a bar named "Joe's" and a female Groundskeeper Willie. He manages to escape, but is no closer to finding the tree, until he happens to stumble across a stray lemon, revealing the tree being kept locked inside a car impound lot.
Back in Springfield, Homer, using Ned Flanders' RV, leads the men to find the boys. When the two groups meet, the boys tell their fathers of the tree being stolen. At the impound lot, the men demand the return of the tree, while the owner of the impound lot, who turns out to be very similar to Homer, refuses and taunts them. Using a plan similar to the Trojan Horse, Bart steers the RV to the outside of the hospital. The RV is taken to the impound lot after it is found parked outside the hospital. When night falls, the Springfield boys and their fathers get out of the RV and tie the tree to the top. The plan nearly fails when Homer drains the RV's power by using the grill to cook chickens, but turns it off in time to escape just before the lot owner shuts the gate. The tree, though considerably damaged during the escape, is returned to Springfield. The children of Springfield celebrate with lemonade, while those in Shelbyville drink turnip juice, much to their disgust, having made up a story about the tree being haunted to cover the embarrassment of losing to their Springfield rivals.