Rav Chisda said in the name of Rabbi Yochanan: from where do we learn that a change [in the stolen object] acquires it [for the robber]? As it is said, 'and he shall restore the robbery' (Leviticus 5:23); and what does Scripture teach by 'that he robbed'? If it is as he robbed it, he returns it, and if not, he need only pay its monetary value. But this 'that he robbed' is needed to exclude his father's robbery, that he need not add a fifth for his father's robbery! If so, let the Merciful One write 'and he shall restore his robbery'; why do I need it written 'and he shall restore the robbery that he robbed'? Learn from this two things. There are those who say: from where do we learn that a change does not acquire it? As it is said, 'and he shall restore the robbery' (Leviticus 5:23) - in any case; but is it not written 'that he robbed'? That is needed to exclude his father's robbery.
When a Change in the Stolen Object Makes It the Robber's Own
Yalkut Shimoni on Torah 479:11
אָמַר רַב חִסְדָּא אָמַר רַבִּי יוֹחָנָן, מִנַּיִן לְשִׁנּוּי שֶׁהוּא קוֹנֶה, שֶׁנֶּאֱמַר "וְהֵשִׁיב אֶת הַגְּזֵלָה" וּמַה תַּלְמוּד לוֹמַר "אֲשֶׁר גָּזָל", אִם כְּעֵין שֶׁגָזַל יַחֲזִיר וְאִם לָאו דָּמִים בְּעָלְמָא בָעֵי שִׁלּוּמֵי, הַאי אֲשֶׁר גָּזָל מִיבָּעֵי לֵיהּ לְמִעוּטֵי גֶּזֶל אָבִיו שֶׁאֵינוֹ מוֹסִיף חֹמֶשׁ עַל גֶּזֶל אָבִיו, אִם כֵּן נִכְתֹּב רַחֲמָנָא וְהֵשִׁיב אֶת גְּזֵלוֹ, וְהֵשִׁיב אֶת הַגְּזֵלָה אֲשֶׁר גָּזָל לָמָּה לִי לְמִיכְתַּב, שְׁמַע מִינַהּ תַּרְתֵּי. אִיכָּא דְּאָמְרֵי מִנַּיִן לְשִׁנּוּי שֶׁאֵינוֹ קוֹנֶה שֶׁנֶּאֱמַר "וְהֵשִׁיב אֶת הַגְּזֵלָה" מִכָּל מָקוֹם, וְהָכְתִיב "אֲשֶׁר גָּזָל", הַהוּא מִבָּעֵי לֵיהּ לְמִעוּטֵי גֶּזֶל אָבִיו.