Elon Musk broke federal labor laws with a single tweet, according to a decision by a California judge last week.

By suggesting employees would be stripped of stock options if they unionized, the founder and CEO of Tesla made what the court said amounted to an anti-union threat on Twitter. He’s the latest in a string of company heads to make such threats on and be penalized.

The founder of Barstool Sports tweeted he would fire any employee who pursued unionizing, while the publisher of the Federalist magazine tweeted organizers would be sent “back to the salt mine.”

“Whether with a billy club in the 1930s or a Twitter account today, those threats are illegal,” said Harley Shaiken, a labor expert at UC Berkeley. He said employers can badmouth unions all they want, but if they threaten retribution for organizing, that violates the National Labor Relations Act.

Tweeting those threats can be effective, he said, because “social media is instant and the reach is much greater.”

These types of violations have been on the rise, said Ryan Nunn, a fellow in economics studies with the Brookings Institution, adding that they’ve contributed to the steep decline in union membership over recent decades.

“What you need to think about are the benefits and the costs for employers to engaging in these activities,” he said. Avoiding a union has big advantages for employers while the punishment for breaking the law in these cases is pretty minor: In Musk’s case, he was ordered to delete the tweet and host a meeting informing workers of their rights.