There are certainly cases where it can. In a repeating game, revenge can be a useful tool to signal to the other party that their actions were not acceptable and to impose a cost on present and potentially future actions of the same type. That's not to say it's typically a good idea.