Many personal-finance experts consider debt to be evil, whether they’re talking about a credit card charging 15.8 percent, an auto loan at 1.9 percent or a mortgage creating a much needed tax deduction. Their advice is always the same: Pay cash.

But that’s an oversimplification. Not all debt is the same; taking it on comes down to its cost of capital and how you plan to use your borrowed funds. If the conditions are right, this leverage can help you preserve cash and put an otherwise illiquid asset to work to build your net worth.

Corporations regularly use debt to optimize their capital structure—and so can you. “Apple recently capitalized on low rates by issuing $5 billion in debt, despite having $178 billion of cash on its balance sheet,” says Joe Elegante, CFA, portfolio manager at RMB Capital of Chicago. “It used the proceeds to repurchase shares of its own stock.”

Why? Apple’s return on invested capital—which has averaged approximately 35 percent for the last five years—is much higher than its after-tax cost of borrowing. “Given the fact that Apple pays a $2.08 dividend (1.6 percent yield) on each share outstanding, reducing the share count actually enhances the company’s financing cash flow,” Elegante explains.

Individuals can be just as strategic with their balance sheets, in far less complicated ways. For instance, rather than using cash to purchase a car, consider taking out a 1.9 percent, 72-month loan, and invest the cash you preserved in an S&P index fund, which has a 10-year average return of 7 percent. If you assume a purchase price of $30,000 with zero money down, using credit could add almost $4,400 (pre-tax) to your balance sheet at the end of five years.

Or imagine the earning power you would have if you used a 4.75 percent home equity line of credit (HELOC) and invested the newly liquid capital in that same index fund for the next 25 years. It’s a strategy that could generate a return of almost $75,000 (pre-tax) for every $100,000 invested. Plus, you’ve diversified, and the interest payments are tax-deductible.

The fine print

Before you scramble to take advantage of cheap debt, consider the risks. Like corporations, individuals who accrue low-cost debt levels today may be forced to refinance them at higher rates in the future, which could have a negative impact on future cash flow. Rising interest rates can also affect income, as well as the value of the assets used as collateral, especially if they trigger an economic downturn (see: the Great Recession).

Consider yourself warned.