Appeal to the law
An appeal to the law (argumentum ad legem in Latin) is an informal fallacy in which someone tries to encourage or defend an action based on its legality, or condemn it as morally reprehensible, purely because it is legal. This line of reasoning is faulty because although the law of the land is important, it does not necessarily match up with the morality or sensibility of an action. In reality, many statutorily forbidden acts are malum prohibitum rather than malum in se. Examples 

 "It is immoral to throw lawn darts." "It is immoral to juul." "So what if I cheated on my husband? It's not like being unfaithful is a crime!" "Filling your shoes with river water is cheap, simple and legal in all 50 states." See also 

 Appeal to consequences
 Argument from authority
 Legal threat
 Circular reasoning

References 

Relevance fallacies
Fallacies
Informal fallacies