As I gazed at the Passover aisle in the supermarket, a scene from “Apollo 13” flashed before my eyes. Tom Hanks and his crew are stranded above the moon with a rapidly depleting supply of oxygen and no possibility of resupply or rescue. If the astronauts are going to fix their ship, they will have to use equipment already onboard. Down below, NASA’s engineers are scrambling to help them do just that. With replicas of the shuttle’s random spare parts strewn across a table, a ground engineer explains the mission to his colleagues in serious tones:

“Okay, people, listen up. The people upstairs handed us this one and we’ve gotta come through. We gotta find a way to make this [he holds up a square peg ] fit into the hole for this [he holds up a round hole] using nothing but that— [pointing to the detritus on the table.]” Beneath him the music swells perilously.

This is, roughly, the dilemma of Passover for industrial food manufacturers. For one week every year, the food scientists at kosher food plants must recreate standard American packaged foods, like cereal and cake mix, using a less-than-ideal bricolage of ingredients that has survived the Passover blacklist.

The result is a mixed bag. But whereas most of the Passover aisle is a mediocre Brigadoon, appearing for only a fortnight each year before being shuttled into clearance bins, studded within the aisle are a few industrial products of genuine quality. These are the Passover candies: the bars of dark chocolate, the tins of almond kisses, the macaroons, the peppermint patties.

Purim is a holiday for sweets, but Passover is a holiday for actual candy. The Passover restrictions handicap both bakers and cooks, but they leave confectioners unharmed: Both sugar and chocolate are perfectly kosher.

But notice that it’s not just any old candy that makes it to the Passover shelves. For example, there’s no such thing as a kosher-for-Passover Mars bar: The candy is too complicated and the market too small for Mars Inc. to make the necessary adjustments to its formula. Instead, the Passover candy scene is smaller manufacturers, and the candies they produce are relics of an era in the history of American sweets that has largely disappeared. To understand this history, let’s consider the most recognizable of all Passover candies: the fruit jelly slice.

•

The fruit jelly slice is an American product invented sometime between the two World Wars in either Winnipeg, Manitoba, or in Boston (two companies claim to have invented it). The shape of the jelly, like the shape of the McDonald’s McRib, pays homage to something that it is not. That something happens to be the candied fruit, grandfather of all modern confections.

First, though, we need to know a little bit about sugar, and the first thing we need to know is that sugar is extremely difficult to work with. Even though it’s been cultivated in small amounts for 8,000 years, refining sugar is so laborious that creating it without government support was next to impossible. The first states with the resources for sugar production were Islamic. For centuries, European sugar was all imported; it wasn’t until the late 14th century that it was manufactured locally, and even then quality varied widely from batch to batch.

The first candies were candied fruit. With refined sugar now widely available, they’ve never been easier to make: Just take a piece of fruit, soak it in sugar and wait until all the juice has been absorbed. Candy still exists in this form; some Moroccan Jews have a Passover custom to eat candied eggplants and oranges, and Armenians eat candied almonds.

In candied fruit, sugar is added to the source of flavor, not the other way around. This is straightforward, but it limits the form that the candy can take. Extracts were the next advance, and they allowed candy to take on virtually any form. Europeans went wild: From the 15th century, sugar sculptures were prized as edible art. Yet just as the price of sugar began falling to levels reasonable for the lower class in the 18th century, another problem arose: the fickle nature of boiling sugar.

Even with the best sugar, making candy is no easy task. The first step is boiling a mixture of sugar and water, but the properties of that mixture change dramatically in the space of a few degrees. 115 C will get you a runny jelly for the inside of a fancy chocolate; overshoot by 10 degrees and you’ll have something closer to toffee. Experienced confectioners could eyeball it, but the need for experts limited production. Scaling up required the thermometer, but that wouldn’t be invented until the 17th century and wouldn’t be perfected for 100 years after that.

But people love candy; eventually, confectioners figured it out. The haphazard process of boiling sugar turned into a well-understood science, one that was ripe for industrialization in both Europe and America. The labor costs of candy plummeted, and consumption (especially among children) surged. This was the emergence of “modern candy.” As Samira Kawash explains in the 2013 book “Candy: A Century of Panic and Pleasure,” by the end of the 19th century, American children could buy jelly beans, candy corn, licorice, toffee and marshmallows. Sugar was once the sole province of the rich and powerful; now it was available in so-called “penny candy” form.

With sugar reasonably priced, with sugar chemistry well understood, and with the federal government carving regulatory loopholes for candy makers, American confectioners both large and small had the resources to experiment. In the first decades of the 20th century, there was an explosion in both branded candy varieties: Jujubes, Jujyfruits, Red Hot Dollars, Mexican Hats, Mounds, Almond Joy, Chuckles, and Walnettos are all products of the pre-World War II candy crush. There was experimentation with usage, too: A 1926 book titled “60 New Ways To Serve a Famous Candy” enumerates dozens of ways to serve an Oh Henry! bar as part of a meal (slicing it into pieces, serving it in a salad, etc.).

•

The sugar-selling business, not a little ironically, follows the rule of survival of the fittest. Many candies die out; the fruit jelly slice — which is too delicate for easy transportation — should have gone extinct in the mass market long ago. What saved it was a gelling agent called agar agar; it’s used in jelly slices and little else. Normally this would be academic, but on Passover it makes all the difference: Since agar-agar is derived from seaweed, it;s okay to use.

In a globalized, industrialized society, observance and Jewish law leads to all kinds of strange and unintended consequences as our knowledge of the world unfolds onto objects, experiences and activities unmapped by rabbinic legislators. Case in point: Though Passover is ostensibly about eating matzos, much of the de facto Ashkenazi Passover diet comprises ingredients that the rabbis of antiquity either rarely ate (sugar, seaweed), had never heard of (coffee), or were cultivated in places that the rabbis didn’t know existed (potatoes, chocolate and quinoa all originated in the Americas). The success of the fruit jelly slice is the production of a moment in time when Jewish legal interests and American industry accidentally collided. It’s a quirk, yes, but so is the maror-and-matzo sandwich we eat at the Seder in memory of something that was convenient for Hillel once upon a time. Tradition is quirky; the bigger our universe, the quirkier it gets. The best we can do it enjoy its fruits.

David Zvi Kalman is the director of Jewish Public Media and the founder of Print-O-Craft. He is a doctoral student at the University of Pennsylvania. Twitter @dzkalman