A story about R. Qatsra and R. Eleazar, who were walking in the gates outside of Tiberias. They saw a coffin of a dead person that had come from outside the Land to be buried in the Land of Israel. R. Qatsra said to R. Eleazar: What benefit is there, since his soul departed outside the Land, that he comes to be buried in the Land of Israel? I read over him (Jeremiah 2:7): "And you made My heritage an abomination" — in your lives; "and you came and defiled My land" — in your death. He said to him: Since he is buried in the Land of Israel, the Holy One, blessed be He, atones for him, as it is said (Deuteronomy 32:43): "And His land atones for His people."
Burial in the Land of Israel Atones for the Departed Soul
Midrash Tanchuma Buber, Vayechi 6:2
מעשה בר' קצרא ור' אלעזר שהיו מהלכין בפולי של חוץ מטבריא ראו ארון של מת שבא מחוצה לארץ ליקבר בארץ ישראל. אמר ר' קצרא לר' אלעזר מה מועיל שיצתה נפשו בחוצה לארץ, ובא להקבר בארץ ישראל, אני קורא עליו, ונחלתי שמתם לתועבה (ירמיה ב ז), בחייכם, ותבואו ותטמאו את ארצי (שם), במיתתכם, א"ל כיון שנקבר בארץ ישראל הקב"ה מכפר לו שנאמר וכפר אדמתו עמו (דברים לב מג).