The Internet was abuzz in the past week because of “The United States of Crazy Laws,” an Olivet Nazarene study charting the bizarre legislation still in place across the land of the free. Many of these regulations seem bizarre—in Arizona it is illegal to keep your donkey awake near a bathtub and in Connecticut a pickle must bounce in order for it to legally be considered a pickle—but others are just niche concerns. That it is illegal to ride a horse while intoxicated just makes more sense in Colorado, where you’re statistically more likely to ride a horse than in New Jersey. And the prohibition against waking a sleeping bear to take a photo in Alaska is a well-intentioned effort to save tourists and social media hawks from themselves (and a mauling).

What even the most obscure and peculiar sounding laws have in common, though, is a very particular and often forgotten history. Each piece of legislation was conceived because of a particular event. The origins of Connecticut’s pickle law were forgotten until reference library Steve Rice found an article about pickle rustling in a 1948 article. According to the Hartford Courant, pickle packers Sidney Sparer and Moses Dexler were arrested for selling pickles “unfit for human consumption.” The then-Connecticut Food and Drug Commissioner Fredrick Holcomb told reporters that a real pickle “should bounce” when dropped on one foot. Residents of the Nutmeg State should feel assured that regulations governing the production and sale of food have grown more sophisticated in the past 60 years.

At least one of the more peculiar laws on the books has its roots in religious principles. In New York State it is illegal to walk around with an ice cream cone in your pocket on Sundays. To be sure carrying a quickly melting sticky substance in one’s clothing seems inadvisable on any day, but the specific regulation against carrying an iced dessert on a Sunday may be tied to puritanical concerns. From the colonial period onwards “Blue Laws” were enforced in order to promulgate religious behavior on the Sabbath. These laws promoted church attendance but also—in the past—prohibited certain profane activities like “indecent bathing" (Georgia), attending a concert (Connecticut), fishing (Delaware), and the sale of candy (Maryland). And in Evanston, Illinois, the Women’s Temperance Union succeeded in banning the sale of ice cream on Sundays.