What is considered an illegal act? It is one that is prohibited by the official rule of law. When you commit an illegal act, It lays you open to attack by the state, government etc... Also, if that act is serious, it leads a person to not living life but instead being always "on guard" in hope not to get picked up by the authorities.
Don't do anything illegal is Way to Happiness precept #9. A simple way of looking at it would be not doing anything you wouldn't want to have done to you.