The best kind of business is one that generates a ton of cash, year in and year out. Companies with plenty of free cash flow -- that is, the cash from operating activities left over after making necessary investments in the business -- have ammunition available for dividends, buybacks, and acquisitions, as well as major investments in new growth initiatives.

What makes a company a cash cow? A high free cash flow margin (the percentage of revenue converted into free cash flow) and a high cash return on invested capital (how much free cash flow is generated from each dollar invested back into the business) are good indicators that a company is pumping out a prodigious amount of cash. Here are three top stocks that fit the bill.

The fattest cash cow of them all

Image source: Apple.

It's no secret that iDevice maker Apple (AAPL 0.64%) generates an outrageous amount of cash. Over the past 12 months, Apple produced $220 billion of revenue and $50 billion of free cash flow, good for a free cash flow margin of nearly 23%. The iPhone has a lot of great features, but the best one is its ability to print cash for Apple.

Apple's cash return on invested capital is also impressive, coming in at about 23.6% using the latest balance sheet data. This number has been in decline, in part because all of the cash building up on Apple's balance sheet is dead weight. But its exceptional nonetheless.

Apple's revenue and free cash flow have been falling because of lower iPhone sales, and there's no guarantee that the new iPhone 7 will be able to reverse that decline. Apple is facing various headwinds as smartphone innovation becomes tougher and mid-range phones improve in quality. The iPhone 7 didn't bring with it any groundbreaking features, and as consumers stretch out the time between upgrades, Apple may have a difficult time returning to growth.

Despite these issues, Apple still generates an incredible amount of cash. The iPhone has proved to be a massive cash cow for Apple; the challenge is to keep it that way.

Coffee, coffee, coffee!

Image source: Starbucks.

Starbucks (SBUX -0.35%) has experienced incredible growth over the past decade, multiplying its revenue by nearly a factor of three. Free cash flow has also soared, turning the company into a veritable cash cow. Over the past 12 months, Starbucks generated $2.85 billion of free cash flow on $20.5 billion of revenue for a free cash flow margin of 14%.

That's not as high as Apple, but selling coffee doesn't demand the same margins as selling high-end smartphones. Where Starbucks really shines is its cash return on invested capital, which topped 30% during the trailing-12-month period. For every dollar Starbucks invests in its business, the company increases its free cash flow by $0.30. This kind of return on investment is a hallmark of companies with substantial competitive advantages.

Starbucks still has plenty of room to grow overseas, even with over 24,000 stores already in operation. In the United States, the company is turning to its high-end Reserve Roasters store format as well as packaged products like K-Cups, bags of coffee, and cold beverages to drive further growth. The company is throwing off copious amounts of cash, something that should continue for the foreseeable future.

A cash cow in transition

Image source: IBM.

Despite the ongoing transformation that International Business Machines (IBM 0.16%) is undergoing, shifting away from legacy, low-margin business toward growth areas such as cloud and cognitive computing, the company remains a cash cow. Over the past twelve months, IBM generated free cash flow of $14.3 billion on $80.2 billion of revenue. That's good for a free cash flow margin of 17.8%.

IBM's cash return on invested capital is an even more impressive 23.7%, close to that of Apple. Even though IBM's revenue has declined by about $11 billion since 2006, its free cash flow has increased by around 45%, a testament to the company's continual focus on shedding commodity businesses and investing in high-value products and services.

IBM's cash-cow status stems largely from its enterprise customer base. Roughly 80% of IBM's clients deploy cross-IBM solutions spanning hardware, software, and services, and industries such as banking, telecommunications, and healthcare rely on IBM's products and services. This sticky customer base with high switching costs allows IBM to navigate its current transition while continuing to pump out a tremendous amount of cash. The company will need to succeed in its turnaround efforts to maintain its cash cow status in the long run, but its long history of reinventing itself bodes well for IBM.