Because it is about justice, it quite naturally communicates to the criminal a number of things related to justice: (1) you have unjustly harmed the common good; (2) you have to pay for that; (3) the suffering you undergo is a consequence of your own action.