It can be an application of the lex talionis (“an eye for an eye”), but is not always proportional justice, as a similar method may be used to produce a worse or milder effect than the crime it ‘retaliates’.
The simplest method of mirror punishment is to enact the same action upon the criminal as the criminal perpetrated upon the victim. For example, thieves have the same amount of money taken from them as they stole; one who strikes another is struck in the same way; one who wilfully causes another person’s death is killed; and so on.
Often, however, a more esoteric method of mirror punishment is used, which implies punishing the part of the victim’s body used to commit the crime. Extreme examples include the amputation of the hands of a thief, as still permitted by Sharia law, or during the Middle Ages in Europe; or disabling the foot or leg of a runaway slave. Other examples include the punishment of adulterous women by the insertion of irritating substances into their vagina (in the past hot pokers were sometimes used). A less extreme example is the putting of soap into a child’s mouth for using inappropriate language (referred to in English as “washing someone’s mouth out with soap”).
Another method to accomplish ‘poetic justice’ is to mirror the physical method of the crime, e.g. executing a murderer with his own weapon, burning arsonists alive, or in a more far-fetched example, boiling a counterfeiter alive (because bullion is boiled to be minted).