Most of the laws are nothing but Figments of imagination..! Far from the truth !
I can vouch for some with ample proof of those from UK where whatever written is absolutely rubbish!
They may not all be rubbish. Practically every country has many such hilarious laws. Some people may be wondering how such apparently silly laws came into existence. Did a group of MLAs or senators sit down together and discuss if, for example, policemen should be allowed to bite dogs ?
Often not. Many such laws came into being because of a court ruling. This may be obvious to some, but not to others. In the example of a policeman biting a dog, what happened was probably something like this: In the course of his duty, a policeman had a lot of difficulty trying to keep a dog under control. Finally, probably after being bitten by the dog a few times, the policeman bit the dog back in desperation. Someone, probably the owner of the dog, sued the policeman. After hearing all the evidence in the ensuing trial, the judge ruled that the policeman was justified in biting the dog.
Unless the ruling was overturned later, it can be used as a basis for judgment later in similar court cases. IOW, it became law. Lawyers love to dig up such previous judgments, called precedents, if they favour their case and use them as arguments in court.
If you take such court decisions out of context and quote them separately as "Law", they often seem idiotic. OTOH, there must be thousands of such "laws" around the world that became buried and forgotten after the initial case.
Or a specific law lost meaning as society and the world changed, and no one tries to enforce it anymore. For example, it is said that, in the early days of the automobile, car owners in London were required to have a man walking in front of them, waving a red flag. That may have been quite reasonable at the time.