It is not public's secret anymore, that if there are some efforts from tax payers, not only individual but also business entity to manage the amount of taxes that they have to be pay to the government. For them the taxes are cost, therefore they need to make some initiative or strategies to minimize the taxes liabilities in order to reach the optimal of the income after taxes.
Generally, the strategies that have been done in a tax planning are considered taking advantages of the "holes" in tax regulation. That is why tax planning is not against the law