Once upon a time, there was a man. Like many men, he held some shares in a few companies. Every week, he would gather with his friends at a local diner.

On this particular morning, one of the stocks he owned had been the subject of an extremely glowing story in the business press. Its shares had increased by 23%. At the diner, his friends exclaimed "Wow! That is tremendous luck!"

"Maybe," replied the man.

Many investors find themselves getting excited by things like press releases, analyst upgrades, and other nice things said about the companies they own. Unfortunately, great press releases aren't necessarily the hallmark of great companies.

Stock prices over time will track their companies' financial performances and little else. A cheery consensus is often quite expensive and provides no real safety. Consider that, of 20 analysts, none rated AIG (NYSE:AIG) a sell -- and the stock is down 90% since, shedding more than $50 billion in market capitalization.

A few weeks later, the man was on his way out to the diner when he heard that the SEC was investigating the company for leaking material inside information to analysts, that the CEO and CFO had been fired, and that its financial statements were going to be restated. Predictably, the stock got clobbered.

When he saw his friends, they exclaimed, "What horrible luck!"

"Maybe," replied the man.

How many times have you wanted to dismiss pieces of information or analyses that are negative on the companies you hold? This is the other side of the incentive bias to which many shareholders succumb.

Rather than considering all of the information they have at the moment and seeing whether their previous analysis is still valid, they close their minds to the possibility that they might have made a mistake, or that subsequent events have altered the company's prospects. Now-defunct wearable computer company Xybernaut hit shareholders with unfulfilled hype, SEC investigations, multiple dilutive offerings, enormous insider options, and compensation packages, none of which seemed to dull the fervor with which its shareholders would "defend" the company against any perceived slight. Xybernaut stock now? "Priceless."

Following the news of the investigation, the man carefully analyzed the situation and decided that despite the drop in stock value, he did not believe that the company offered good prospects. So he sold the company, called Zenron. Six months later, the company collapsed, as investors found that it had stashed billions of dollars of debt in hidden subsidiaries and millions of dollars of cash in executives' numbered accounts in the Cayman Islands.

When his friends realized he would have lost everything if he had held on, they exclaimed, "Great luck!"

"Maybe," replied the man.

One of the biggest mistakes that investors make is culling winners and cultivating the weeds. A stock isn't a better bargain simply because its share price has gone down. One very constant refrain we see with stocks that have gone down a lot is: "It's only $2 per share; how much further can it go down?" The answer -- as shown by companies like Enron, Lehman Brothers, and even Sirius XM (NASDAQ:SIRI) -- is "100%."

He decided to try to find IPOs for his cash. He signed up through his brokerage to participate in offerings, but he found that he was never allocated shares. Meanwhile, IPOs like MasterCard (NYSE:MA) and Chipotle (NYSE:CMG) rocketed.

His friends at the diner said, "What rotten luck!"

"Maybe," replied the man.

Though many people look at the IPO market as easy money, the fact is that most newly public companies underperform the market, and the number of IPOs that do well is relatively small. Some do spectacularly, which causes the market to maintain high levels of interest in participating. Yet both MasterCard and Chipotle went up several hundred percent after their IPOs -- an even bigger jump than when they first came public. And after the IPO, there was no gatekeeper to keep anyone from getting an allocation.

Instead, the man rolled his money into companies like TransMontaigne and TODCO. Both were taken private within months after he bought them, at substantial premiums to his purchase prices.

Naturally, his cohorts at the diner toasted his good fortune: "What great luck!"

"Maybe," replied the man.

During the bull market, private equity and other going-private transactions took a significant number of companies of the New York Stock Exchange. Generally, buyers paid 10% to 40% more than the quoted price for these companies, creating financial windfalls for shareholders.

The thing is, though, that strategic buyers who overpay for businesses don't stay in business very long. And if you are forced to sell a company at a 20% premium that would have doubled, tripled, or more over the following years, that was not a good deal for you.

That night, the man sat at home, reading annual reports, wondering where to put his money to work next. Sitting by his side was a check, made out to the Internal Revenue Service for the amount of gains he'd generated by selling in 2007.

His diner friends were aghast: "What terrible luck!"

"Maybe," replied the man.

As hard as it is to pay taxes, sometimes it turns out to be best to lock in gains -- before they disappear. As investors in companies like PotashCorp (NYSE:POT), ConocoPhillips (NYSE:COP), and First Solar (NASDAQ:FSLR) could attest, it's better to pay taxes on gains than not to have any gains to pay taxes on.

The next morning, the man looked through the paper at all the shares he'd owned -- considering whether he should buy them back … for half of what he'd gotten for them last year.

Bill Mann cultivates. He is the co-advisor of the Motley Fool Hidden Gems small-cap investing service and the advisor of Motley Fool Global Gains, our international investing service.

This article was originally published on March 21, 2007. It has been updated by Dan Caplinger, who doesn't own shares of the companies mentioned. The Fool owns shares of Chipotle Mexican Grill, which is a Motley Fool Hidden Gems selection and a Motley Fool Rule Breakers pick. Try any of our Foolish newsletters today, free for 30 days. All such circumstances are rooted in impermanence. The Motley Fool has a disclosure policy.