One purpose of such a statement is that it releases governments, since they are the only entities that pass laws, from their obligation to inform the public about new laws passed. It also provides the government -- since they are the ones that prosecute crime -- a distinct advantage in controlling its citizenry and getting convictions. Because it is via criminal convictions that governments maintain power. It is a method of control whereupon, people are afraid of venturing outside the "known" boundaries of what is permitted.
The phrase is similar in nature and in conjunction with the "we are a nation of laws" propaganda. Simply because there is a law permitting or restricting something doesn't make it just. In reality every nation is made up of laws -- but that does not make laws passed legitimate. The US often makes claims that another country's laws go against laws of nature. The laws of Communist China or under Nazi Germany were the laws of a nation. That doesn't make the laws right or just. In fact the US went to war because of laws of another country that "we" felt were -- wrong, unjust and inhumane.