Commentary for Berakhot 13:25
בקש להודיעו דרכיו של הקב"ה ונתן לו שנא' (שמות לג, יג) הודיעני נא את דרכיך אמר לפניו רבש"ע מפני מה יש צדיק וטוב לו ויש צדיק ורע לו יש רשע וטוב לו ויש רשע ורע לו אמר לו משה צדיק וטוב לו צדיק בן צדיק צדיק ורע לו צדיק בן רשע רשע וטוב לו רשע בן צדיק רשע ורע לו רשע בן רשע:
"Show me now Thy ways" (ibid. 5:13). Moses said before Him, "Lord of the Universe, why is there a righteous man enjoying prosperity and a righteous man afflicted with adversity ? Why is there a wicked man enjoying prosperity and a wicked man afflicted with adversity?" He answered him, "Moses, the righteous man who enjoys prosperity is the son of a righteous father ; the righteous man who is afflicted with adversity is the son of a wicked father ; the wicked man who enjoys prosperity is the son of a righteous father ; the wicked man who is afflicted with adversity is the son of a wicked father."