You just so happen to have a credit card with a 0% interest rate for the first year, so you decide to use that to buy the CD. Here, you're 5% ahead. If you had used your $100, you'd have earned only $5 with your CD. However, since you borrowed the money, you earned $50 from the CD instead.
It might not sound like much, but if it were $1,000 and $10,000, you'd have earned $50 versus $500. And the more you borrow (to a point), the more you stand to earn from using this investment strategy. Of course, borrowing more may increase your interest rate, so that's also important to figure into the calculation.