On his deathbed, Yaakov Avinu requested from Yosef that he should be buried with his forefathers and not be buried in Mitzrayim. The Gemara in Sanhedrin learns from here that a tzadik should not be buried next to a rasha. The commentaries explain one of the reasons for this is that Shomayim reveals the secrets of the Torah to tzadikim after their passing. However, the impurity of a rasha prevents these revelations from taking place.
Rabbi Aharon Dovid Singer
Rosh Kollel, NMB Kollel
305-972-6508