In the opening pages of a recent installment of the children’s book series The Hardy Boys, black smoke drifts though the ruined suburb of Bayport. The town's residents, dressed in tatters and smeared with ash, stumble past the local pharmacy and diner. Shards of glass litter the sidewalk. “Unreal,” says the mystery-solving teenager Joe Hardy—and he's right. Joe and his brother Frank are on a film set, and the people staggering through the scene are actors dressed as zombies. But as is always the case with Hardy Boys books, something still isn’t quite right: This time, malfunctioning sets nearly kill several actors, and the brothers find themselves in the middle of yet another mystery.

Eighty-five years have passed since readers first encountered both the Hardy Boys and their teen-detective counterpart, Nancy Drew, yet new books continue to be released several times a year. The novels bear the same pseudonyms as the originals: Franklin W. Dixon and Carolyn Keene. A few things have changed, though—characters listen to MP3 players and reference science-fiction movies, and Hardy Boys chapters (oddly) alternate between the first-person perspectives of Frank and Joe. But the main modern achievement of the series is simply that it continues to exist.

The secret behind the longevity of Nancy Drew and the Hardy Boys is simple. They’re still here because their creators found a way to minimize cost, maximize output, and standardize creativity. The solution was an assembly line that made millions by turning writers into anonymous freelancers—a business model that is central to the Internet age.

* * *

If writing seems like a lonely profession, try ghostwriting children's books. “You're usually in touch with one person, the editor,” says Christopher Lampton, who wrote 11 Hardy Boys books in the 1980s. He sent his books not to a publisher but to a packager called Megabooks—effectively a conduit between the writer and the publisher, Simon & Schuster. When Lampton mailed in drafts, they came back with comments written in several colors. “There were other people, looking at your books, making comments. They're phantoms,” he says.

Book packagers are a kind of outsourced labor, not unlike factories in China or tech-support centers in Mumbai. They develop new story ideas, recruit and manage freelance writers, and edit the first drafts of series books. Then they deliver manuscripts to the publisher, who rewrite and polish them to produce the final book. “Hiring a book packager is a way of hiring staff without putting them on your payroll,” explains Anne Greenberg, who worked for Simon & Schuster from 1986 to 2002, when Lampton was writing. Greenberg edited hundreds of Nancy Drew mysteries after they came in from book packagers, and suspects she worked on more books in the series (approximately 300) than anyone else. “You have to keep feeding the machine,” she says.

Alice Leonhardt, who wrote Nancy Drew books for Megabooks, never even met the intermediaries who passed on her manuscripts to the publisher. “I have no idea where they were,” she says.

The industry that churns out children's books has changed surprisingly little in the last century. In 1905, a prolific writer named Edward Stratemeyer founded a network of freelance writers and editors. Though you might expect a writer collective to support writers the way labor unions support laborers, the Stratemeyer Syndicate's central aim was simply to produce a huge number of books at the lowest possible cost. “Edward Stratemeyer was a genius,” says Greenberg. “He was like an idea machine.”

The Stratemeyer Syndicate helped prove that book packaging with ghostwriters could be incredibly profitable—for managers and owners, at least. Writers signed away their rights to royalties and bylines in exchange for a flat fee. (Early on, it was around $100 per book.) The syndicate launched dozens of series, guessing that only a few would be hits. It debuted Tom Swift in 1910, followed by The Hardy Boys in 1927, and Nancy Drew in 1930. That same year, Stratemeyer died in New Jersey, by then not so much a writer as a tycoon.

Readers rarely hear about book packagers, yet they're responsible for some of the most successful fiction series in existence, from Sweet Valley High to Goosebumps to For Dummies. Because ghostwriters and freelance editors do most of the work, packagers push down the considerable expenses of literary labor: They don't need to offer health insurance, vacation time, or office space.

There are a few benefits in writing for packagers, of course. First, they free writers from having to market and brand themselves, since they’re writing for series that have been established for decades. Leonhardt says it was a relief not needing to do book tours or media appearances.

Second, the pay can be pretty good. Lampton spent about two weeks writing each manuscript, not including the time it took to develop new plots and edit manuscripts. Each book earned him $5000 in the 1980s. Leonhardt was paid $2000 up front and $2000 upon completion of each Nancy Drew book. At the time, giving up royalties and name recognition was just part of the deal. “You know that when you sign on the dotted line,” says Lampton. “I just liked seeing the check show up.”

* * *

Simon & Schuster, which still publishes Nancy Drew and the Hardy Boys, won't reveal the names of its current writers. (Book packagers are still fairly common in the industry, though some franchises—Nancy Drew and the Hardy Boys included—have simply adopted the practices of packagers by contracting writers directly.) But strangely, the most recent Hardy Boys book, Deception on the Set, hints at the nature of writing children's fiction today. As Frank and Joe discover after some energetic detective work, the book's culprit—guilty of sabotaging film sets and nearly killing several actors—is a disgruntled writer.

The book's plot essentially goes like this: Years ago, a character named Cody co-wrote a zombie script with his friend Josh. Cody moved on to new things, but Josh kept at it and found funding to direct the film. When Cody demanded credit for his contributions, however, Josh refused to give him anything more than a role as stuntman. That's Cody's motive for trying to sabotage the film.

The readers aren't supposed to identify with Cody. Even before he gets caught, the book uses words like “grunt” and “growl” to describe his dialogue, which transparently foreshadows his guilt. After he gets caught, his collaborator Josh gets the last word, explaining that he rewrote the script alone and generously offered Cody the stuntman position. Cody presumably winds up in jail, and Bayport returns to normalcy.

It's oddly easy to side with the criminal in this case, though. Characters in the book take the same attitude as the publisher: You don't need to know the writer's name, because he’s already been paid off. So of course he's disgruntled. He helped write something and someone else took all the credit.

* * *

Ghostwriting might constrain writers, but it can free them, too. Writers put their best efforts into the narrative equivalent of a potted plant, but they also work under the comfort of anonymity, which allows them to make a living without being accountable to readers, or without worrying about their reputations. The best and luckiest writers use ghostwriting to carve out the freedom for the kind of bylined writing they care deeply about.

Less fortunate writers often try to do that, too, but they can end up shackled to the mercenary work they intended to outgrow. This was true for the first Hardy Boys ghostwriter, Leslie McFarlane, who was initially relieved that his name wouldn't appear in the series. But by the time he had written 21 books, many readers knew his name anyway. Before he died, he worried that he would be remembered primarily for his work on the Hardy Boys, instead of the films he directed and the series books that bear his name. Unfortunately, he was right.

Still, there are some unexpected benefits. Ghostwriting seems to teach writers to intuitively balance making books and making a living. Though Leonhardt wrote in an age of typewriters and snail mail, writing for an assembly line arguably equipped her with the basic insights of writing for the Internet age. “To be a successful writer in today's world, you have to be obsessed,” she says. “With the marketing, the promoting, the querying, coming up with ideas, being able to deal with all that rejection. And understanding that this is a business—not just a creative endeavor.”

Modern media seems to have learned a lot from packagers like the Stratemeyer Syndicate and Megabooks. When advertising became less lucrative and publications laid off staff writers, editors started to rely on freelancers to fill the gaps in quantity and quality. In a few cases it worked, but more often writers became vulnerable to tiny flat fees, intense competition, and the erosion of intellectual property rights. When a Nancy Drew writer turns in a manuscript, she has to expect that it will take on a life of its own, as phantom editors rewrite it and credit it to a writer who doesn't exist. Online writers often expect the same—that their work will be aggregated and reposted and misquoted.

The problem—for writers, and for writing itself—is that it's easier to be a ghost than to be a writer. There’s frequently more money in writing advertising copy than in writing essays. And by ceding ownership of what you do write, you're relieved of the need to fight for it. This is what book packagers taught writers, long before the Internet came along.

These days, the Nancy Drew and Hardy Boys factory is overseen by two Simon & Schuster editors, Amy Cloud and Alyson Heller. Both agree it's essential to maintain the integrity of pseudonyms like Carolyn Keene and Franklin W. Dixon. “Kids write letters to Franklin,” says Heller. “Kids definitely believe that they're still around.”

“If I had found out that Francine Pascal didn't write the Sweet Valley High books back in the day, I would have been devastated,” Heller says.

It’s almost certainly preferable for readers to believe that stories materialize effortlessly, without the labor of an assembly-line of authors and editors. “We try to keep the air of mystery around it,” says Cloud. Writers are ultimately in the business of making mysteries, not solving them—even when that means writing themselves out of their own story.