I love nothing better than finding a company that pours buckets of cash into my portfolio. Private-equity funds do, too, but often the cash they're angling for is yours. They love to make public companies into their own ATMs through a shrewd device that you should beware, and their plundering of companies offers a key lesson for investors like us.

Like an ATM, but better
One legendary private equity shop, Kohlberg Kravis Roberts (KKR), has perfected the ability to extract exorbitant sums of cash from companies in a perfectly legal way. Take a look at the recent stunt it pulled on Dollar General.

KKR and fellow investors Citigroup (NYSE:C) and Goldman Sachs (NYSE:GS) took Dollar General private in July 2007 at a cost of $7.3 billion. They released the company back to the public markets this past November, offering about 10% of the shares in an IPO and retaining the rest. Following its launch, the company was valued at $7.2 billion.

Now, it looks like Dollar General's investors lost $100 million on the deal, so where's all this profit I'm talking about?

For that, you have to examine how Dollar General was used while it was private. When KKR bought Dollar General in 2007, it and fellow investors put up just $2.8 billion and borrowed the remaining $4.5 billion. At that time, Dollar General had just $260 million in debt, the interest on which it could easily cover with its earnings.

Fast-forward to November 2009 and the IPO. Dollar General suddenly had about $4.2 billion in debt, and its ability to support its own debt is severely crimped. In fact, the business has to pay about 39% of its operating income just in interest. Ouch!

That sudden debt spike shows that KKR and its co-investors simply transferred their borrowings of $4.5 billion onto Dollar General's balance sheet. For their efforts, they took home a 150% paper profit (based on the IPO price), excluding fees and the costs of some rather minimal work they performed in reorganizing Dollar General -- much of which was charged to Dollar General.

As a final kick to the curb, just before making it a public company, the private-equity giant paid itself and other investors a fat dividend, to the tune of $239 million -- more than double what Dollar General earned in that quarter. As a public company, Dollar General doesn't even pay a dividend. And that's not the amazing part.

The amazing part
Of the IPO, Bloomberg quoted one analyst as saying, "It's a good price for investors." If by investors, he means KKR and its cronies, then this analyst is spot-on. But for individual investors like you and me, the deal is an awful mess.

What is utterly astounding, mystifying, and discombobulating about this whole process is that investors buy what KKR is selling. After all, no one's under duress to buy a second-tier retailer, and you could even more easily pick up shares in a slow-growing cash cow such as Verizon (NYSE:VZ) or Procter & Gamble (NYSE:PG) and be none the worse off.

But, again, why buy Dollar General? If you must have a retailer, there are quite a few financially sound organizations with good competitive advantages available at cheaper prices. Certainly, that's one reason superinvestor Warren Buffett bought shares of Wal-Mart (NYSE:WMT) instead of the latest IPO peddled by private-equity firms.

The key lesson: Beware not only what you buy, but from whom you buy.

When Dollar General hit the markets again, it sported a 26.9 P/E ratio -- a stunning 77% higher than that of Wal-Mart, the world's biggest retailer. Even after it reported substantially increased quarterly income, Dollar General still trades at more than 22 times earnings, still higher than the well-heeled and more secure Target (NYSE:TGT). That's expensive for such a leveraged deep discounter, especially one poised to lose its attractiveness as we pull out of our economic slump and customers return to full-price and "plain ol' discount" retail.

It's little surprise that KKR waited until November 2009 to unleash Dollar General. After all, private equity sells when it estimates the market is highest, and KKR is a private-equity leader for just that very reason. And the unattractive position of Dollar General likely explains why KKR did not spin out the entire company: Investors simply wouldn't stomach this stinky investment in one gulp. But there are still plenty of cheap, undiscovered companies.

Whither my investment dollars?
Rather than invest in discounters teetering on the brink, stick to cash-rich companies that are well-positioned to ride global growth. Motley Fool Hidden Gems has recommended several virtually debt-free small-cap retailers that have room to expand around the world, yet none of the financial drawbacks of the latest private-equity deal.

Hidden Gems co-advisor Seth Jayson selected Guess? (NYSE:GES) as a candidate for Hidden Gems' real-money portfolio. In his analysis, Seth noted the company's ability to generate free cash flow at a prodigious rate. In fact, Guess? had tripled free cash flow in the five years ending in April 2009. At that time, it was trading at a reasonable valuation, and despite a near-double since then, the stock still trades at 18 times earnings.

If you'd like Hidden Gems co-advisors Seth Jayson and Andy Cross to help you find superior small-cap ideas and avoid the curse of buying someone else's ATM, you can check out all of our Hidden Gems stock research, as well as our eight "Buy First" small caps for new money now, free for the next 30 days.

Click here for more information.

Already a Hidden Gems member? Log in here.

Fool contributor Jim Royal, Ph.D. doesn't own shares of any company mentioned. Wal-Mart is an Inside Value recommendation. Procter & Gamble is an Income Investor recommendation. The Fool owns shares of Procter & Gamble. The Fool has a disclosure policy.