We all invest for the same reason -- to make money. And to make money investing, we need to know two key things: when to buy and when to sell.

If you can buy something for $1 and turn around and sell it for $2, you've made money. If, on the other hand, you buy something for a buck and can't find someone willing to take it off your hands for more than $0.50, you've lost money. Clearly, to make money at investing, the goal is to buy low and sell high. More than half a century ago, Benjamin Graham, the pioneer of value investing, came up with a simple way to do just that -- a concept known as the margin of safety. By employing this technique, investors greatly decrease the chance that they'll lose their hats, and increase the likelihood that they'll trounce other investors.

Following in Graham's footsteps, Bill Miller, who runs Legg Mason Value Trust (FUND:LMVTX), beat the market for 15 consecutive years. That's a record practically unheard of in the mutual fund industry. Even so, Miller's long-run performance pales in comparison to that of Warren Buffett, a former pupil of Graham's. What's more, Graham's margin of safety is something we put to good use at our Motley Fool Inside Value investing service.

Know a company's true worth
The key to success is a clear understanding of a company's true worth. With that knowledge in hand, buying low and selling high becomes a simple matter of waiting -- buying a stock only when it falls below the company's true worth by a tempting margin. Once you own it, you need to keep tracking the company's value. When the stock rises to an uncomfortably high premium to its true worth, sell it.

Following that philosophy, we at Inside Value have stayed ahead of the market. We've done so without relying on rocket-to-the-moon stocks like search titans Google (NASDAQ:GOOG) and Baidu.com (NASDAQ:BIDU). While those companies certainly seem to have the hot hand right now, they run advertising-dependent businesses whose valuations are dependent on maintaining extremely rapid growth. On such a risky foundation, their fortunes can change for the worse, quickly.

Instead, we've relied on stalwarts like Lloyds TSB (NYSE:LYG), a leading British bank with a better-than-6% yield. We picked it in October 2004 based largely on the fact that its shares were trading well below their true worth. While it hasn't skyrocketed like the search titans have, its shares have outpaced the S&P by nearly 20 percentage points since being picked. Not a bad move for a company in an industry that's currently feeling a world of hurt thanks to the American subprime mortgage meltdown. 

Buying low with the margin of safety
Every company has what Graham calls an intrinsic value -- a measure of what that company is really worth. Finding that value is part art and part analysis. One of the most powerful tools in a value investor's toolkit is a discounted cash flow calculator, into which you put your estimate of how much cash the company will generate in the ensuing years. The calculator then tells you how much the company is worth today. (Inside Value has such a calculator available to subscribers. If you're already a subscriber, you can access it here. If not, you can get access by taking a free 30-day trial of the newsletter.)

Once you've figured out what the company is worth, you can use that information to determine whether or not it has enough of Graham's margin of safety to be worth buying. Right now, for instance, the aforementioned subprime mortgage meltdown is utterly destroying many of the weaker players in housing and related industries. Yet both building supply distributor Builders FirstSource (NASDAQ:BLDR) and housing material supplier USG (NYSE:USG) have been chosen as Inside Value picks.

Even if the housing market never booms again, people will still build and renovate their homes, providing steady business to the surviving companies in the industry. If you believe that, thanks to their fundamental strengths, USG and Builders FirstSource will be among those survivors, then the time to buy is when their shares are available cheaply. As both firms currently trade as though they may never grow again, you can buy what look like solid businesses at reasonable prices -- and get any growth for free. Contrast that with the "better grow or else" valuation baked into both Google's and Baidu's shares and ask yourself which is really a less risky way to invest.

Selling high with the margin of safety
Logically, if a company trading below its intrinsic value is worth buying, then a company trading at or above its intrinsic value just might be a candidate for selling. Inside Value advisor Philip Durell recommended just such a sell for day labor giant Labor Ready (NYSE:LRW) after the shares leapt on the heels of a tremendous earnings report in July. Key to the sell decision was the fact that the then-elevated price meant that the company was no longer a bargain.

Of course, concerns that the company's business was too tied to residential construction during a slowing housing market also contributed to the decision. Even so, nobody really predicted the company's 30% drop since that sell recommendation was made -- but the fall was far more likely from its elevated perch than from the bargain basement.

Follow the formula
Once you've figured out what a company is really worth, its margin of safety will tell you when it's time to buy and when it's time to sell. The lower a company's price with respect to that intrinsic value, the stronger the margin of safety, and the better the chance that buying that company will lead to a profitable investment. The higher a company's price with respect to intrinsic value, the more that margin of safety has been reversed, and the better the chance that it's time to sell your position and take the extra profits from your bargain-hunting trip.

Like the idea of knowing how to buy low and sell high? Want more value investing tips and techniques? Start with a free 30-day trial of Inside Value, The Motley Fool's home of the margin of safety.

This article was originally published July 13, 2005. It has been updated.

At the time of publication, Fool contributor and Inside Value team member Chuck Saletta did not own shares of any company mentioned in this article. Baidu is a Rule Breakers choice. Lloyds TSB, Builders FirstSource, and USG are current Inside Value picks. The Fool has a disclosure policy.