
A sage, Rabbi Yitzchak, argued that one who speaks ill of the dead is as one who speaks ill of a stone, that there is no problem in speaking ill of the dead. Some of the scholars explained that the dead don’t care if they are spoken ill of, since they do not know and do not hear what people say of them, and some of the scholars said that the dead hear and know, but they just don’t care. The scholars asked: Did not the sage Rav Papa relate an incident in which someone spoke ill of the sage Shmuel of Nahardea after his death, and a beam fell on the person and smashed his skull? This implies that one speaking ill of the dead is punished. Answer: It is indeed the case that the dead do not hear and do not care, but when a Torah scholar is defamed, the holy One, blessed be He, avenges his honor and punishes the one who spoke ill.
(Babylonian Talmud, Tractate Berachot 19a)