You only get punished if your caught and proved guilty. We don't have all the details on how this works but when a crime is committed some form of evidence is left behind and people can use it to try and find out who your are and come after you, this depends on your skills and theirs.
this is for crimes where the punishment is you losing some time off your characters life span.
But keep in mind that if you brag about committing a crime then the town your in might tell you to leave or they'll burn your house down. even if they cant prove its you, if the actual players knows it you then they can come after you and just not prosecute each other for it.