Good observation. At least, so long as they agree with the law they use to justify themselves!
But to use statutory law this way is to confess that they either don't know right from wrong, or are willing to do evil if it's legal (or if they run no legal risk). This is ironic. Until recently, -- and no doubt still so today in some jurisdictions, -- not knowing right from wrong was the LEGAL definition of criminal insanity!
The thinking is, if a person is incapable of understanding that he is committing a criminal act, he cannot be tried for the crime. He IS, however, locked away in a padded cell, so that he can't do it again.
Those who hide behind statutory law to justify immorality are candidates for that padded cell. They don't know right from wrong.
Some posters are quick to mention the rule of law. They are from the george greer school of thought which is the highest of insult.