Some laws yes, many laws are not legislating morality. Many are designed to line the pockets of the lawyers. Think about it.
Yes, that might the actual motivation. But all laws in essence say “Thalt shall not...” whatever is being banned or regulated.