"There are no such things as bugs in code; the computer always executes the code as written."
Loopholes and bugs are differences between intent and effect.
Loopholes and bugs are differences between intent and effect.
On the other hand, there are certainly cases where a loophole is obviously not the intent of the legislators, and regardless of the legality of exploiting it, one could justly view exploiting it as immoral.
For example, sticking with the analogy of computer bugs, a multiplayer videogame that has an obviously unintended glitch, which lets you cheat against your fellow players.