Be honest. When you are standing at the gas pump, refilling your car and watching the numbers spin higher and higher, don't you wish you had some stock in Exxon Mobil (XOM, news) or BP (BP, news)?

Of course you do.

Is it a good idea?

Let's do the math.

Fuel prices are rocketing -- again. Gasoline is up to $3.64 a gallon nationwide. It's doubled in 10 years and trebled in 20.

You can blame Iran. You can blame China. You can blame quantitative easing.

But whomever you blame, the problem's the same. Your costs are rising, but your income probably isn't. Fuel prices have outpaced incomes for generations. Today the average worker earns enough each week to buy just 200 gallons of gas. Back in the late 1970s, the figure was 300 gallons.

In the parlance of finance, you have a liability without a corresponding financial asset. A bad move. When prices rise, you have to either cut back on what you spend on fuel, or cut back elsewhere.

According to Labor Department data, gasoline makes up about 5% of consumer spending. In 2010, the most recent year for which we have data, the bill came to about $2,100.

Since then it has risen about 30%. By some crude math, that's costing a typical household another $600 or so.

Michael Willis, chief executive of niche fund company The Willis Group, is among those who has been arguing for some time that we ought to invest where we spend. He calls it "consumption-based asset allocation." (His firm even runs two small mutual funds, Giant 5 Total Investment System (FIVEX) and Giant 5 Total Index System (INDEX), based on the idea.) "If you buy it," he says, "we really think you ought to own it."

When it comes to energy, you can take matters into your own hands pretty easily.

Integrated oil companies are probably the easiest way for ordinary investors to play the energy sector. They are less volatile than either smaller energy companies or the companies that provide services or lease deep-sea rigs.

The iShares S&P Global Index (IXC, news) exchange-traded fund owns foreign oil giants including Total (TOT, news), BP and Royal Dutch Shell (RDS.A, news), as well as Exxon and Chevron (CVX, news).

Maybe you're better off waiting for a pullback: Your guess is as good as anyone's on whether that will occur. But what is noticeable is that big integrated oil stocks, even after a strong recent run-up, still look inexpensive in relation to fundamentals.

This is especially true for overseas companies. Thanks to the European stock market panic, France's Total, Italy's Eni (E, news), and Royal Dutch Shell are all on seven to eight times forecast earnings, with dividend yields between 4% and 5%. Exxon, by contrast, is about 10 times forecast earnings with a yield of barely 2%.

BP stock still hasn't recovered from the pounding it took during the Gulf of Mexico Deepwater Horizon oil disaster two years ago. Even today it is still about a fifth lower than it was just before the Macondo blowout. And yet oil prices are much higher than they were then.

Oil companies are famously profitable and robust. They throw off enormous amounts of cash, and -- a rarity in business -- like to return it to stockholders in the form of dividends and buybacks.

For amusement I recently went back and looked at all the hysterical commentary about BP stock during the Gulf oil affair. The company was doomed, people said. Even some very well-known commentators predicted it would file for bankruptcy. The stock collapsed by more than a half, wiping out more than $100 billion in equity. The bonds slumped to junk levels. The Obama administration professed to be so worried that it insisted BP give advance warning before moving around any money or assets.

Click here to become a fan of MSN Money on Facebook

It's hard to read some of the commentary today without deep embarrassment about our modern, semi-hysterical culture. BP today, to little surprise, is in robust health. It paid most of the costs of the crisis by cancelling dividends for a few quarters.

Energy stocks have more than doubled in 10 years. Clearly they aren't quite the bargain they were then. And you may feel you already have enough energy stocks in your portfolio through a diversified mutual fund. Energy makes up, for example, about 12% of the broad Vanguard Total Stock Market Index (VTSMX) fund. But there's a decent case for owning more. If you're standing at the pumps, feeling like a victim, it's something to think about.