"A loophole is an ambiguity or inadequacy in a system, such as a law or security, which can be used to circumvent or otherwise avoid the purpose, implied or explicitly stated, of the system." [1]
A loophole is by definition legal, otherwise it would be fraud.
That's why it's called a 'loophole' - when the letter of the law is followed, but the intent is subverted (or what people imagine what the intent should have been).
I am pretty sure the lawmakers intended it exactly as it was used. I'd give them benefit of doubt if they closed the hole within a year after discovery, but this is the most well known tax loophole of which even children know the name, used for several decades.
I guess nothing it's illegal if you are not prosecuted/convicted for the said activities. Not even if you are a war criminal (see the recent Trump saga).
The tax rules are confusing and complex enough so that only the wealthy can benefit(i.e. use loopholes).
A loophole is by definition legal, otherwise it would be fraud.
[1] https://en.wikipedia.org/wiki/Loophole