July of 2014 wasn’t the kindest month to soccer superstar Lionel Messi. On top of losing to Germany in the World Cup Final on the shoulders of his poor performance, Messi is now being charged with tax evasion in Spain.

Spanish authorities are questioning whether Messi paid enough taxes, if any, on his income from 2007 to 2009. The Spanish government believes that Messi and his father Jorge owe $5 million in back taxes, and that the two Messi’s knowingly set up a series of shell companies to disguise his income. The Messi family has denied any wrongdoing.

It is bewildering that a player of Messi’s social stature, calm demeanor, and wealth would engage in a shell company scheme, as Messi takes home over $60 million per year in salary and endorsements. He makes enough in one month to pay off the entire sum. Yet, higher profile celebrities throughout history have similar run-ins with the law over possible tax crimes (Nicholas Cage, Willie Nelson, Martin Scorsese, Wesley Snipes, and many others come to mind).

Regardless of the Messi outcome, shell companies are actually a very common way for individuals and corporations to legally and illegally increase profits and improve business efficiency. Shell companies are cheap to set up, require little maintenance, and often leave a near-invisible paper trail. Here’s how they work, how they are properly utilized, and how they can land someone behind bars.

Shell Corporations: Legitimate Corporate Vehicles

A shell corporation is a non-traded corporation without any active business operations. They can be set up in a matter of days with minimal time and paperwork. They typically have little or no revenue and very few assets, and many of them don’t even have a physical location to speak of.

Because they exist as real corporations, shell companies often act as a vehicle for a parent company to obtain financing, enable asset transfers, increase efficiency, improve brand image, or obtain a more favorable tax rate. Thus, in many scenarios, shell corporations are perfectly legal.

Brand Management: A shell company can be utilized to improve or manage a brand’s reputation. For example, a premium Scotch whisky maker with a top-tier reputation may decide to enter the business of making cheap, low-quality whisky. To avoid tarnishing the integrity of the brand, the company can set up a shell company and sell the cheaper whisky under a different name. The parent company would still maintain complete control over its new budget brand, but the public would probably never know unless they researched the corporate structure, thus keeping its reputation in tact.

Reverse Mergers: When a private company acquires a public company in order to bypass the IPO process, commonly known as a reverse merger, shell companies are often at the center of such transactions. Shareholders in the private company can buy up all the shares in the public shell company and merge the shell with the private company. A shell-facilitated reverse merger can be completed in weeks, while a more traditional acquisition/IPO process takes months.

Tax Benefits: Corporations commonly set up a shell company within the boundaries of an international tax haven. The corporation can run its international business through the shell company, which is taxed at the lower domestic tax rate. Many corporations such as Apple (AAPL) have drawn criticism for setting up shell operations in foreign countries to avoid paying taxes at the American corporate rate.

These practices are legal, but that’s not to say shell companies can’t be used to facilitate criminal white-collar activity. There’s a very fine-line between strategic management and ending up in a prison cell.

Fraudulent Shell Operations

Shell companies are often the vehicle behind tax evasion, money laundering, bankruptcy fraud, market manipulation, and other various operational schemes. They typically leave no paper trail because they have no tangible assets and can sometimes get away with submitting very little legal paperwork.

Money Laundering: The process of transforming money obtained from crime into money that appears to have come from legitimate sources. For example, a drug trafficker can launder dirty money through a shell company by declaring illegal drug proceeds as legal income through his or her “business,” which is actually a shell company with no real operations.

Bankruptcy Fraud: The concealment of assets to avoid the surrender of these assets during bankruptcy court. Before a company plans to go bankrupt due to insolvency, it might decide hide its assets in a shell company. During the bankruptcy process, the company usually needs to liquidate its assets, but illegally hiding these assets inside a shell company enables the company or its managers to illegally retain some of its assets.

Billing Schemes: When a shell company bills for services that don’t exist. For example, an accountant for a PR firm can create a shell company, bill the PR firm for fake services that the shell company never provided, and pay the fake bill on behalf of the PR firm. As the owner of the shell company, the accountant is writing checks from the PR firm to himself. A large firm may never notice.

Market manipulation: Shell companies are frequently used in pump and dump schemes, as they can be used to facilitate fake stock offerings. The shell company may appear to have a legitimate business model, and investors may be excited to buy shares amid rumors about the company’s potential. In reality, these rumors may be fabricated by the manipulators. After the buyers enter and the share price rises, the market manipulators sell their shares, and the company is revealed as a worthless shell company.

All of these activities are highly illegal and can land the perpetrator behind bars. This is essentially what Lionel Messi is being accused of; Spanish authorities believe that he set up various shell companies to avoid paying traditional Spanish income tax. There are many scenarios when shell companies can legally improve business operations, but disguising income as something else is certainly not one of them.