rap
beat the rap escape punishment for or be acquitted of a crime. North American informal
rap someone on (or over) the knuckles rebuke or criticize someone.
take the rap be punished or blamed, especially for something that is not your fault or for which others are equally responsible.
☞ The late 18th-century use of rap to mean 'criticism' or 'rebuke' was extended in early 20th-century American English to include 'a criminal charge' and 'a prison sentence'. Compare with take the fall (atfall)