¿Cuándo un castigo se convierte en delito?

¿Cuándo un castigo se convierte en delito?