Addressing the Argument: The Hadith “The dead is punished because of the lamentation of his family” Contradicts the Qur’an
The hadith literature cites the Prophet Muhammad as saying: "The dead is punished because of the lamentation of his family" [Saheeh Muslim, Book 4, Hadith 2022]. Does this not contradict the Qur'an which states: "No bearer of a burden will bear another's burden" [35:18]?
This is a valid question, for even confusion regarding this matter arose amongst some of the companions including the Prophet's wife Aisha. The confusion arose mainly due to how these words of the Prophet (peace be upon him) were being transmitted by some of the companions. The problem was that they were being spread in the unconditional general sense without clearly informing the people whom the Prophet (peace be upon him) was specifically referring to.
Who was the Prophet (peace be upon him) specifically referring to when he said "The dead is punished because of the lamentation of his family"?
The majority of the scholars said that refers to someone who influenced his family either directly by asking them before he dies to lament his death or indirectly by doing so himself when someone dies and acting as a role model for his family to follow suit. It is an established historical fact that this was common practice amongst the Arabs back then . So given that he would have influenced their behaviour to do this, by default he would also be responsible for their actions and also be punished as a result. This wouldn't violate the Qur'anic verse regarding Allah not punishing people for the sins of others.
Some early scholars such as Imam at-Tabari and several later scholars such as Qadi 'Iyaadh, Ibn Taymiyyah, Ibnul Qayyim, etc. understood the statement of the Prophet "The dead is punished because of the lamentation of his family" differently. They didn't understand "punished" as connoting "being punished for a crime", but rather understood it as "suffering". They believed that the person in the grave would emotionally suffer by being exposed to the lamentations of his family. They base this on a hadith transmitted by at-Tabarani, Ibn Abi Shaybah and others where the Prophet (peace be upon him) said that we shouldn't make our loved ones suffer for they would be exposed to our lamentations  & .
My (Bassam Zawadi) personal belief is that the stronger opinion appears to be the first one favored by the majority of the scholars, however one is more than free to adopt the other option as well.
In summary, when looking at the historical context and other narrations as a whole along with the statement of the Prophet (peace be upon him), we come to know that there is no necessary contradiction present here.
1) Ibn Mandhur in his Lisaan al-Arab cites Ibn al-Atheer as saying: يشبه أن يكون هذا من حيث أن العرب كانوا يوصون أهلهم بالبكاء والنوح عليهم وإشاعة النعي في الأحياء ، وكان ذلك مشهورا من مذاهبهم فالميت تلزمه العقوبة في ذلك بما تقدم من أمره به
2) Ibn Hajar said that the isnaad is hasan. He said: قلت : يا رسول الله ، قد ولدته فقاتل معك يوم الربذة ، ثم أصابته الحمى فمات ، ونزل علي البكاء ، فقال رسول الله صلى الله عليه وسلم : أيغلب أحدكم أن يصاحب صويحبه في الدنيا معروفا ، وإذا مات استرجع ، فوالذي نفس محمد بيده ، إن أحدكم ليبكي فيستعبر إليه صويحبه ، فيا عباد الله ، لا تعذبوا موتاكم . وهذا طرف من حديث طويل حسن الإسناد ، أخرجه ابن أبي خيثمة ، وابن أبي شيبة ، والطبراني وغيرهم ، وأخرج أبو داود ، والترمذي أطرافا منه
3) This hadeeth finds some support in meaning from the statement of Abu Hurayrah where he said that the works of relatives would be displayed to the dead. Ibn Hajar said: قال الطبري : ويؤيد ما قاله أبو هريرة أن أعمال العباد تعرض على أقربائهم من موتاهم ، ثم ساقه بإسناد صحيح إليه ، وشاهده حديث النعمان بن بشير مرفوعا ، أخرجه البخاري في تاريخه ، وصححه الحاكم