The treaty commentaries offers two viable options; the choice really depends on how treaties interact with local law as defined in that jurisdiction. This question goes to a treaty’s dual status – they are interpreted at a “public international” level (the level of the state and higher) and a domestic level (the level of the state and lower). For a further explanation of how this works, please see Professor Michael Edwards-Ker’s writings on tax treaties.
When the tax treaty is interpreted as being superior to local law, the commentaries offer the following solution:
Other States prefer to view some abuses as being abuses of the convention itself, as op-posed to abuses of domestic law. These States, however, then consider that a proper construction of tax conventions allows them to disregard abusive transactions, such as those entered into with the view to obtaining unintended benefits under the provisions of these conventions. This interpretation results from the object and purpose of tax conventions as well as the obligation to interpret them in good faith (see Article 31 of the Vienna Convention on the Law of Treaties).
As I noted in my first post on tax treaties, they in general have the understood purpose of promoting the exchange of goods and services between countries and increasing the flow of payments between countries. Transactions which do not promote these ends could be considered de facto abusive, giving the state the ability to deny treaty benefits.
When local or domestic law governs treaty interpretation, the commentaries offer the following solution:
Thus, any abuse of the provisions of a tax convention could also be characterised as an abuse of the provisions of domestic law under which tax will be levied. For these States, the issue then becomes whether the provisions of tax conventions may prevent the application of the anti-abuse provisions of domestic law, which is the second question above. As indicated in paragraph 22.1 below, the answer to that second question is that to the extent these anti-avoidance rules are part of the basic domestic rules set by domestic tax laws for determining which facts give rise to a tax liability, they are not addressed in tax treaties and are therefore not affected by them. Thus, as a general rule, there will be no conflict between such rules and the provisions of tax conventions
Put in less formalistic terms, should the domestic law govern, the tax treaty does not void nor have any voice in the application of that jurisdiction’s anti-avoidance law provisions. As an aside, almost all jurisdictions have some type of “substance over form” doctrine. In the US this is referred to as the “economic substance” doctrine and has been formally codified. But regardless of the specific name, most jurisdictions have some set of rules to apply in this situation.