Ali ibn Ibrahim narrated from his father, from al-Nawfali, from al-Sakuni, who reported:
Abu Abdillah عليه السلام was asked: "What is the reason that a deceased person discharges semen?" Imam عليه السلام replied: "It is the sperm from which he was created that is expelled."
Ali Akbar al-Ghaffari
Tahdhīb al-Aḥkām fī Sharḥ al-Muqniʿah, vol. 1, p. 477