I'm not sure it is the case that all of a sudden it is legal. I think it has been the case that a borrowing made to invest in shares of a foreign affiliate by a Canadian firm is generally deductible in computing the taxable income and tax payable of a Canadian firm.
What you see in a classic double-dipping case is that the investment in those foreign affiliate's shares has been turned into a loan from that foreign affiliate to another country, and that country is also allowing a deduction for it.