I hate that term
loophole. If it’s in the written law, then it is legal. The term has a connotation, when used in regards to taxes, as somehow being illegal, or some kind of mistake that was not meant to be intentional.
It is neither and has/had a purpose when it was inserted into the law.