Unless you've been living under a rock for the past few years, you've probably noticed the prices at the gas pump. While they're down off their all-time highs, they're still significantly higher than they were just a few years ago. High oil prices are an ugly menace throughout our economy, for several reasons.

First, direct oil products such as gasoline are heavily influenced by the price of oil. Oil goes up, and it takes gas with it, boosting the price you pay at the pump. The more you spend on gasoline, the less you have available to spend on, well, anything else. To make matters worse, though, high oil prices don't just affect your driving. After all, virtually everything you buy has to get from its manufacturer to the store. Getting there requires ships, trucks, and trains. You know -- large, fuel-consuming vehicles.

Pervasive costs
As a result, when fuel prices go up, so do the costs incurred by shippers such as LandstarSystem (NASDAQ:LSTR) and Swift Transportation (NASDAQ:SWFT). Yet since gas prices are felt throughout the industry, it's easier to pass the charges on down the line and eventually to you, the consumer. So not only do high oil prices mean that you pay higher prices to get to the store to buy stuff, but the cost of that stuff is also higher, thanks to the cost of shipping it there.

As if that weren't bad enough, have you looked at your electric bill lately? At least around me, prices are up some 30%. Once again, the culprit is, at least in part, oil. Electric utilities like Duke Energy (NYSE:DUK) and American Electric Power (NYSE:AEP) try to generate energy at the lowest feasible total cost. Often, that entails running a mix of plants with different fuels, as well as potentially contracting for supplies from the general grid. When one fuel source spikes in price, as oil did, it tilts the balance in favor of the other types of energy. Increased demand for those alternative fuels drives up their prices, too. As with the transportation fuel costs, an industry's pervasive costs eventually get passed along to consumers.

Even the winners are losers
With costs rising throughout the economy, thanks in large part to higher oil prices, it may seem that the only winners from high oil prices are the oil companies themselves. Unfortunately, as is often the case, even their glory is fleeting. Oil is a tricky and ugly business.

The up-front costs for oil companies are enormous. First, there's the costly trouble of going around looking for the stuff. While we're not really running out of oil, much of the easy -- let's call it Clampett -- oil has already been found. That makes exploring for the remaining stuff that much more tricky. Once it's found, there's still the pesky (and costly) business of negotiating with governments and property owners for the right to extract it. Throw in the costs of drilling and the costs of building an infrastructure to transport whatever oil is found to the refiners to turn it into useful products, and the costs skyrocket. Worse yet, all those bills have to be paid before anyone has sold one drop of oil.

Those high up-front costs mean that most exploration occurs when oil prices are high. After all, given the significant investment required in getting started, it takes fairly profitable operations to fund those charges. Therein lies the problem and the reason why oil remains a volatile cyclical commodity -- and while oil stocks may not be cheap even though they sport such low multiples today.

Perverse incentives
As soon as more oil starts to flow, the economics change. Instead of being a pure cost drain, a producing tap becomes a revenue source. As long as the oil coming out of that tap can be sold for more than what economists call "the marginal cost to produce," the owner of that well wants it to flow. In other words, if the pure extraction and transport costs from a given well are $15 a barrel, as long as oil prices are $15.01 or more, that well will run. If a company or government shuts down a well that's covering its marginal costs, it's essentially handing over gross profits to its rivals. Nobody wants to hold back production in order to benefit competitors.

Of course, the total costs to run an ExxonMobil (NYSE:XOM) or a ConocoPhillips (NYSE:COP) are higher than just extraction and transport. Since oil flowing from the wells provides a huge source of revenues for these giants, the gross profits have to fund everything else. If you assume marginal costs of $15 a barrel, a market price of $20 provides $5 a barrel to cover all the overhead and exploration. At a market price of $65 a barrel, that turns into $50 a barrel to cover other expenses.

Exploration can be slowed down when oil prices are low, but other overhead costs cannot easily be stopped. As a result, when oil prices start to dip, there's less gross margin from each barrel of oil to cover those overhead costs. With large fixed costs that need to be covered, though, the only short-term option is to produce even more oil.

Put it all together, and you'll see that when prices start to drop due to an oil glut, supply doesn't naturally shut down to keep it in balance with demand. Once prices start falling, they tend to keep falling, until the price drops below the marginal cost to produce the next barrel. Then and only then do the economics dictate that the taps get shut down. Hence, oil is and will continue to be an exceptionally volatile commodity.

Why it matters
As investors, if we want to profit from oil, we need to understand how its market works. The time to buy the oil giants like ExxonMobil or ConocoPhillips is not when oil prices are high and their profits gushing. That's exactly the time when exploration and drilling will most likely lead to new sources, higher supplies, lower prices, and lower future profits. Instead, the time to buy is when oil prices are low and their profits look fleeting.

That's why, at Motley Fool Inside Value, we don't have a single oil company selected in our market-beating portfolio. That may change, however, the next time oil bottoms out and things look dim for the industry. As we value investors know, the time to buy is when prices are low.

Now you're asking: If oil companies and their single-digit P/Es aren't cheap today, then what stocks are? Join us today at Inside Value free for 30 days, and we'll tell you.

At the time of publication, Fool contributor and Inside Value team member Chuck Saletta had no ownership stake in any of the companies mentioned in this article. Duke Energy is an Income Investor recommendation. The Fool has a disclosure policy.