By now, the hamburger is such a crucial part of America’s identity that it’s hard to imagine a time when it wasn’t being hailed as our de facto national dish.

But according to Hamburger America author George Motz, the burger as we know it is less than a century old. Like everything from pizza to bagels, hamburgers were once considered ethnic food, associated with the immigrant community that initially brought them to the country.

Yet the hamburger’s—or, as it was known at the time, the Hamburg steak’s—time as aniche German-American food was brief. Immigration “was starting to spread,” Motz says, outside of the country’s urban centers: “People wanted farmland, so they began moving out. They brought their foods with them, and one of those foods was the Hamburg steak.”

The spread of immigrant communities collided with the increasing popularity of state fairs to introduce hamburgers to the American public at the turn of the 20th century. Such fairs were historically significant for two reasons: “The introduction of new technology, and the need to eat.” And while the hamburger may not have been a revolutionary innovation, it fulfilled the second need just fine.

Before the hamburger could achieve true mass appeal, however, it had to work through some image issues. Burgers “were served by lunch carts for people who worked in factories,” Motz says, and their “contents were questionable at best. People were getting sick; it was not really something that anybody who could avoid it would eat.” It took a Wichita chain with distinctive architecture and a knack for PR to take the burger to the next level.

From there, the burger blew up, in production as well as popularity. As “the technology behind the burger [became] more important than what it tastes like,” McDonald’s, Carl’s Jr., and others figured out how to meet demand as quickly and widely as possible—until their approach backfired, creating an opening for chains that do prioritize high-quality ingredients.

The road between Ellis Island and the Shake Shack IPO is a long one, touching on the assimilation of immigrant groups, the mechanization of fast food, and the country’s renewed focus on quality over convenience. Here, Motz walks us through the five distinct phases of the American hamburger’s evolution.

Illustrations by Albert Hsu

Immigrant Food: Steaks on a Plate

It’s easy to guess the hamburger’s geographic origin; after all, it’s right there in the name. But the original version of the now-iconic dish looked almost nothing like what’s served at drive-thrus across America.

Motz says the Hamburg steak plate was one of the most popular dishes in its native city, a major port that hosted many German immigrants on their way to the States. Consisting of “chopped beef that was turned into a patty and then, of course, pan-fried,” the dish was rounded out with onions, potatoes, and gravy, making it a cheap and easy meal for would-be Americans stuck in immigration limbo, sometimes for months.

It’s these immigrants who brought the Hamburg steak across the Atlantic, setting up carts in lower Manhattan that catered to new arrivals in search of comfort food. The vendors preserved the steak plate in its original form—an actual plate of food, served with a fork. Authentic, but as Motz notes, “not very portable at all.”

Proto-Burgers and the Dark Age

That all changed with the rise of state fairs at the end of the 19th century, considered ground zero for fast-food innovation long before deep-fried Coke came onto the scene. Hungry fairgoers in search of sustenance wanted something both calorie dense and travel-ready.

“It took the introduction to state fairs for people to say, ‘Hey, you know what? Let’s take this Hamburg steak and put it on some bread,’” Motz says. He compares the hamburger’s evolution to that of the ice-cream cone, another product of the state fair: Just as one enterprising vendor put ice cream on top of a waffle to create an edible, portable container, Hamburg steak sellers put their offering in between two slices of bakery bread. And so the Hamburg sandwich was born.

With the standardized bun still a few decades away, the Hamburg steak was presented on whatever was available to a particular vendor, such as the toast still served at New Haven’s Louis’ Lunch, a 115-year-old establishment that boasts the title of oldest continually operating hamburger restaurant in the country.

This, unfortunately, is when the hamburger enters its dark ages. From 1900 to 1920, the burger was what Motz calls a “wage-earner food” avoided by those who could afford to—a reputation guaranteed by both the low-quality meat most restaurants used, and the publication of the famous novel, The Jungle, which further perpetuated this stereotype. “The combination of Upton Sinclair and people not eating great burgers spelled doom for the hamburger,” Motz says, and it took a revolutionary fast-food chain to save it.

Restoring Glory at White Castle

White Castle’s glory days may be behind it, but Motz emphasizes that the chain “is one of the most important hamburger restaurants in America,” and its founding in the 1920s kicks off “the most extraordinary phase in the history of the hamburger.” So why is White Castle as important to burger history as it is to stoner movies? Two words: safety and consistency.

Founder Walt Anderson came up with the idea of using higher quality meat at his Wichita burger stand, but partner Billy Ingram had the idea that would enable White Castle’s expansion—its name, which broadcast purity (“White”) and security (“Castle”) to wary potential customers, who “wanted to see a place that was staffed by young men with clean shirts on and white paper caps,” as Motz puts it.

With its clean-cut vibe and iconic design (modeled after the Chicago water tower), White Castle began to attract customers from outside the working class. Its subsequent expansion, however, was also enabled by consistency, symbolized by what may be the restaurant’s most enduring contribution to the hamburger: the bun, which transformed the burger from a subspecies of sandwich to a dish in its own right.

Anderson and Ingram’s baker “made the exact same bun every single time,” giving White Castle a uniform and scalable product several decades before the golden age of fast food.

Post-War Mass Production and Standardization

Most of the innovation that marked fast food’s post-war heyday had little to do with the burger itself, but rather how it was made and distributed—with the notable exception of size. The invention of the patty machine in the 1930s increased the hamburger from a diminutive ounce and a half, á la White Castle’s signature sliders, to the quarter pounders found at McDonald’s everywhere today.

Freezers, assembly lines, and drive-thrus further mechanized the burger-production process. Implemented out of necessity during World War II, when meat was tightly rationed and even banned from restaurants on Tuesdays, freezing allowed chains to scale up even further. What began as “just a way of saving money” thus became standard industry practice, damaging burger quality but making it easier for chains to stockpile meat.

Restaurants like McDonald’s began to concentrate on efficiency, eliminating time-wasting carhops and having burgers ready for customers when they walked in the door (though it took patrons about a month before they figured out no one was meeting them curbside and they had to physically enter the restaurant). “Being ready was a big deal,” says Motz. “In a minute and a half, you could be eating a burger.”

While In-N-Out has famously never frozen its patties, the chain did develop the modern, speaker-operated drive-thru, giving workers a crucial two-minute lead on assembling customers’ meals. Several Southern California locations even have the remains of a quickly abandoned “double drive-thru” system, evidence of just how much speed, scale, and efficiency were at a premium during the post-war boom years—even if the burgers had lost White Castle’s original claim to quality.

A Renaissance in the 21st Century

The 21st century boom in fast-casual is inspired by a return to the old-fashioned hamburger. As Motz points out, newer chains like Five Guys and Jake’s Wayback are essentially capitalizing on nostalgia for a product older restaurants like In-N-Out or Steak ‘n’ Shake never stopped selling: “People who are older can remember before burgers were frozen; they bite into a burger that is a fresh-beef burger, and the first thing they say to me is, ‘This reminds me of what burgers should be and were.’”

“There was this shift towards, ‘What do we do with these really bad hamburgers?’” he says. “That’s why everything has changed.”

By re-emphasizing taste over convenience, the zeitgeist has directly enabled the rise of Shake Shack, Smashburger, and their imitators—restaurants that can keep their prices relatively low while also boasting farm-fresh ingredients and specialty offerings from the likes of David Chang. Which brings us to the current state of burger obsession—and explains not only how the owner of the critically acclaimed Gramercy Tavern came to found a publicly traded fast-food chain, but also why top kitchens from around the country are bringing the burger-and-patty combo back into the fold.