You're right! With a man-made law, exploiting a loophole is counter to the spirit of the law. However, Torah is divine, and hence perfect, so the "loophole" is also Torah. Think about it.
Thousands gather in Kuala Lumpur for rally urging Malaysian leader to quit (AP)
from the article: How to be religious - and enjoy a Shabbat espresso