As long as people have been telling jokes, people have been stealing them. Take the celebrated comedian Milton Berle, a guy so notorious for lifting from others’ routines he was known as “The Thief of Bad Gag.” Of all Berle’s suspect material, one particular joke stands out for its lack of originality: “A man comes home and finds his best friend in bed with his wife. That man throws up his hands in disbelief and says, ‘Joe, I have to—but you?’ ” According to Jimmy Carr and Lucy Greeves, in their book Only Joking: What’s So Funny About Making People Laugh, the joke bears an uncanny resemblance to one found in the fourth century tome Philogelos, the world’s oldest-known joke book: “Someone needled a well-known wit: ‘I had your wife, without taking a penny,’ He replied, ‘It’s my duty as a husband to couple with such a monstrosity. What made you do it?’ ” For this joke to get from Philogelos to Berle, it was likely passed from one humorist to another for 1,700 years. If Berle stole it, in other words, he was hardly the first.

These days, with so much comedic material captured and preserved on smartphones, YouTube clips, and tweets, joke-stealing allegations are proliferating. Roseanne Barr accused Two and a Half Men of nabbing some of her material. The Huffington Post wondered if Chris Rock had borrowed a gag from his admirer, Aziz Ansari. Sammy Rhodes, a University of South Carolina campus minister, took a hiatus from Twitter after he was roundly criticized for plagiarizing funny tweets.

With all of this joke borrowing going on, what’s an aggrieved comedian to do? Does anyone actually own a joke, after all? What legal recourse, if any, does that owner have when some hack swipes his best material?

Several years ago, legal scholars Dotan Oliar and Christopher Sprigman asked themselves these questions in response to one of the most prominent joke-theft cases yet: In 2007, Joe Rogan confronted Carlos Mencia onstage at the Comedy Store in Los Angeles and accused him of stealing material. News of the clash, which was caught on video, caused some to bemoan the state of comedic plagiarism, while others argued that every comedian steals and is stolen from—it’s just part of the job.

In the wake of the controversy, Oliar and Sprigman decided take a scholarly look at the matter. “It just seemed odd,” says Sprigman, a visiting professor at the University of Virginia School of Law. “We just wondered, ‘Is this thing normal, that comics confront each other? What else do comics do when they think a joke is stolen?’ ”

After conducting telephone interviews with 17 working comedians at various levels of success in the industry and scouring the legal literature, they discovered that there’s not a lot comics can do about a stolen joke, at least officially. Copyright law defends the expression of an idea, but not the idea itself. So even if somebody stole your joke about bad airline food, there’s little you can do if that person tells the same joke with slightly differently wording—no one owns the idea of mocking bad airline food. And even when a comedian does have a legal basis to accuse somebody of copyright infringement, it can be expensive to do anything about it. (According to the American Intellectual Property Law Association, the average cost for both the plaintiff and defendant in a copyright case that goes to trial can range from $373,000 to $2.1 million.) Maybe that’s why Oliar and Sprigman couldn’t find a single instance of one comic suing another for copyright infringement. (They did find a few instances of well-heeled humorists suing noncomedians over joke theft, like the time Jay Leno, himself an accused joke lifter, sued writer Judy Brown for allegedly pilfering his one-liners for her joke books.)

There’s another problem with accusing someone of stealing your jokes. Sometimes similar jokes appear because the material is just ripe for the taking—great minds think alike. Take one of the jokes Mencia was accused of stealing: In his January 2006 Comedy Central special No Strings Attached, Mencia did a bit about plans to build a border fence to keep Mexicans out of the States that ended with the line, “Um, who’s gonna build it?”

Comedian Ari Shaffir claimed Mencia took the joke from him, and as proof he cited video footage from two years earlier, in which he noted that California Gov. Arnold Schwarzenegger wanted to build a border wall and then cracked, “Dude, Arnold, um, who do you think is going to build that wall?”

It’s compelling evidence, but then again, as Oliar and Sprigman discovered, in 2006, comedians D.L. Hughley and George Lopez also told similar versions of this joke. It’s possible that news reports at the time of the proposed border wall were so rampant, and so laughable, that multiple comedians came up with the same punch line.

It’s also possible that Mencia, Hughley, and Lopez all lifted the bit from Shaffir—but even if they did, they might not have realized it. Comedians constantly mine material from their own experiences, and since they spend so much of their time listening to other comedians, sometimes other comedians’ jokes get caught up in the production cycle without the thief even realizing it. In a lengthy essay on joke stealing, Patton Oswalt admitted to having done this early in his career: “I stole a joke. Not consciously. I heard something I found hilarious, mis-remembered it as an inspiration of my own, and then said it onstage.” And one of the more famous joke-stealing controversies—Dane Cook being accused of borrowing from Louis C.K.’s routines in his 2005 album Retaliation—might have been due to the same phenomenon, as C.K. himself acknowledged. When Cook made a cameo on C.K.’s show Louie, the two discussed the alleged plagiarism, and C.K. noted, “You’re like a machine of success, you’re like a rocket, and you are rocketing to the stars. And your engines are sucking stuff up, stuff is getting sucked up in your engines like birds and bugs and some of my jokes.”

In the early years of stand-up comedy, hardly anyone complained when a comedian stole a joke, whether it was on purpose or not. This was the era of the one-liner, says Sprigman, when most jokes could be slotted in and out of various routines with very little regard to who actually created them. But that changed in the wake of innovators like Lenny Bruce, who didn’t just deliver zingers, but instead told stories and imbued them with a distinctive voice. “There was a shift in comedy from one-liners to a personalized style,” says Sprigman. “These comedians felt more invested in their material, more protective of it.”

While the law doesn’t provide much in the way of protection for comedians, Oliar and Sprigman found that today’s comics do maintain an informal set of rules. If two comics come up with a similar joke, for example, it’s understood that whoever tells it first on television can claim ownership. Similarly, if two comedians are working on material together, batting ideas back and forth, it’s generally agreed upon that if one comedian comes up with a setup and the other the punch line, the former owns the joke.

Those who don’t follow the rules can face escalating repercussions. First they’re subjected to badmouthing; then they get blacklisted from clubs. Finally, if the unacceptable behavior continues, it’s understood that things might get physical. While none of the comics Oliar and Sprigman interviewed admitted to participating in or witnessing fights over stolen jokes, many had heard stories, and they accepted such violence as a possible, if remote, outcome. As one comedian told the researchers, “ … the only copyright protection you have is a quick uppercut.”

Far from being dismayed by this extralegal system, Oliar and Sprigman came away impressed by the comedians’ informal arrangement. “They have managed to put together a community project that requires a pretty high-level amount of group coordination,” says Sprigman. It’s a lot better than the joke-stealing free-for-all of Berle’s era. And it’s hard to imagine a more formal joke protection system, involving copyright filings and other legal procedures, working well in a world where comics are constantly generating and tweaking new material. In fact, Sprigman thinks this joke-stealing code could work for other industries struggling with how to balance creativity and copyright issues, including the music and tech industries. They should borrow it.

Next up: Tracing the birth of stand-up.