Fraud, for example, isn't legal even if you have a cleverly crafted contract that uses wording tricks to technically be true.
I would expect a court to take a dim view of a smart contract that has an obfuscated, non-obvious mechanism for someone to siphon off all the money in an undisclosed fashion. "Code is law", but so's "you can't defraud people".