The Messenger of Allah ﷺ said, "Whoever follows a Muslim's funeral seeking reward, and remains with it until the prayer is performed over the deceased and the burial is completed, will return with two qirats of reward, each qirat like Mount Uhud. Whoever prays over it and returns before the burial will return with one qirat."Ishaq's version states, "out of faith and seeking reward," and says, "If he returns before the body is placed in the grave, he will return with one qirat."
حدثنا محمد بن جعفر قال حدثنا عوف وإسحاق يعني ابن يوسف الأزرق قال أخبرنا عوف المعنى عن محمد
أن رسول الله ﷺ قال من تبع جنازة مسلم احتسابا وكان معها حتى يصلى عليها ويفرغ من دفنها فإنه يرجع من الأجر بقيراطين كل قيراط مثل أحد ومن صلى عليها ورجع قبل أن تدفن فإنه يرجع بقيراط قال إسحاق إيمانا واحتسابا وقال فإن رجع قبل أن توضع في القبر فإنه يرجع بقيراط
[Shakir: 10340] Its isnad is sahih. It occurred previously at 9866. [Shakir: 10341] Its isnad is sahih. This is a display of precision from Imam Ahmad, in which he clarifies the differences in the wording.