A superb book that addresses retribution in the chapter on capital punishment,  is The Line Through the Heart: Natural Law as Fact, Theory, and Sign of Contradiction by J. Budziszewski (2009).

Here is an excerpt.

“Society is justly ordered when each person receives what is due to him. Crime disturbs this just order, for the criminal takes from people their lives, peace, liberties, and worldly goods in order to give himself undeserved benefits. Deserved punishment protects society morally by restoring this just order, making the wrongdoer pay a price equivalent to the harm he has done. This is retribution, not to be confused with revenge, which is guided by a different motive. In retribution the spur is the virtue of indignation, which answers injury with injury for public good. In revenge the spur is the passion of resentment, which answers malice with malice for private satisfaction. I am not here concerned with revenge, only with retribution.

“Retribution is the primary purpose of just punishment as such. The reasons for saying so are threefold. First, just punishment is not something that might not requite evil (as, for example, it might or might not rehabilitate the criminal); requital is simply what it is. Second, without just punishment evil cannot be requited at all. Third, just punishment does not require any warrant beyond the requiting of evil, for the restoration of justice is good in itself. True, just punishment may bring about other good effects. In particular, it might rehabilitate the criminal, it might physically protect society, or it might deter crime in general. Although these might be additional motives for just punishment, they are secondary.” (pp. 114-115)