In Machshirin 4:7, we learn:
פֵּרוֹת שֶׁנָּפְלוּ לְתוֹךְ אַמַּת הַמַּיִם, פָּשַׁט מִי שֶׁהָיוּ יָדָיו טְמֵאוֹת וּנְטָלָן, יָדָיו טְהוֹרוֹת וְהַפֵּרוֹת טְהוֹרִים. וְאִם חָשַׁב שֶׁיּוּדְחוּ יָדָיו, יָדָיו טְהוֹרוֹת וְהַפֵּרוֹת בְּכִי יֻתַּן:
If produce fell into a channel of water, and one whose hands were unclean put out his hands and took it, his hands become clean and the produce [also] remains clean. But if his intention was that his hands should be rinsed, his hands become clean and the produce comes under the law of ‘if water be put.’
In his commentary, the Bartenura writes that the person's hands are clean only with respect to eating ḥullin; with respect to teruma and ḳodashim, the hand-washing requires intention to be effective.
Why is there such a distinction, and what is the source of this distinction?