Shares of GameStop (GME -3.94%) soared as high as $483 last week. By midday on Tuesday, the stock price had fallen below $100 per share.

Behind the volatile stock price is a battle between retail investors who frequent the WallStreetBets subreddit and hedge funds, which have heavily shorted shares of GameStop and a number of other stocks in recent years. The WallStreetBets group has also targeted AMC Entertainment Holdings (AMC 8.23%), BlackBerry (BB 1.82%), and Nokia (NOK 6.11%), among others, which have seen their stocks swing violently over the last couple weeks.

Whether you bought into one of those stocks or watched the action from the sidelines, there are some important lessons everyone can learn from what's happened.

Wall St street sign in New York's financial district.

Image source: Getty Images.

1. Markets can be irrational sometimes

At the stock's peak, GameStop's market capitalization was over $24 billion. Any rational investor could look at GameStop's business -- an unprofitable brick-and-mortar retailer with declining sales -- and tell you its intrinsic value is far less than $24 billion.

But intrinsic value isn't the only thing that moves stock prices. If it were, stock prices wouldn't change every second of every market day. The market consists of humans making buy and sell orders. Humans are greedy, spiteful, fearful, and generally irrational creatures often with incomplete information.

Warren Buffett is fond of a quote he attributes to his mentor Benjamin Graham: "In the short-run, the market is a voting machine -- reflecting a voter-registration test that requires only money, not intelligence or emotional stability -- but in the long-run, the market is a weighing machine."

There was no way of knowing GameStop shares would balloon to a $24 billion valuation. Or that members of a small internet forum would boost the share price to the point of causing a short squeeze, forcing hedge funds to cover their positions. There's no way to know the share price won't go even higher than that in the short term. But the good long-term bet is to expect shares to fall to GameStop's intrinsic value.

2. Trading and investing are not the same thing

The WallStreetBets saga is a big lesson in the difference between trading and investing.

Trading a stock is buying shares based on the idea that you'll be able to sell them to someone else for a higher price in the near future. For example, if you and a group of internet strangers can trigger a massive short squeeze, it will artificially inflate demand for shares. Some market participants who shorted the stock may be forced to buy, presenting an opportunity to sell your shares at a higher price. These moves can be violent and are usually short-lived, so strike while the iron's hot.

Investing is buying a piece of a company. Shareholders get to partake in the revenue, earnings, and cash flow of the companies they own. They're rewarded when the company succeeds, and they're punished when the company fails. Buying shares in a company with a strong outlook and holding them for the long term is investing, and it's a more sustainable path to build wealth.

3. Play to win the game

If you frequent the WallStreetBets subreddit, you'll find dozens of posts from members encouraging others to hold onto their shares. As a result, members have gained and lost millions of dollars in the span of just a couple weeks.

There were countless stories published over the weekend of traders who turned their life savings into a bounty big enough to retire on. But investors who didn't sell last week have seen their retirement dreams dashed in the span of just a few hours. And they're a shining example of why you play to win. Money is nice; not having to worry about money is nicer.

When you've built a substantial lead on your path to retirement, you should start playing more prevent defense and switch your offense to a more conservative ground attack. Your asset allocation should look a lot different when you're trying to maintain wealth than when you're trying to build wealth. You'll want more assets that retain value, like treasury bonds and value stocks, and fewer growth stocks.

When a single holding grows to dominate your portfolio, you should consider selling some and diversifying. It's possible it could keep outpacing the rest of the market, but you don't have to take that risk. Remember lesson 1, the market can be irrational; that doesn't mean you have to be irrational, too.