Sorry but the law has to have a rational basis...there can be inherently illegal laws...
The basis of a just law—what makes it just—is that it comports with the natural moral law.
The presence of a preamble is absolutely, totally irrelevant.