Q. A Jew is walking on Shabbat and sees a baby crawling in the street. He picks up the baby and gives it to the mother who is nearby. She slips a $100 bill in his pocket to thank him and walks away. What should he do? He cannot take out the money because it is muktza; he cannot shake it out because he is transferring from reshus hayachid (pocket) to reshus harabbim (the street).

A. When someone is in a street, the objects he carries are considered to be in a reshus horabim or public domain and not in a private domain. If there is no eiruv, he will not be able to carry the money on his pocket more than four amos (about two meters).
Coins are inherently (muktze machmas gufo – Mishna Berura O.H. 310: 24) and banknotes are chisaron kis (loss of valued object – Shemiras Shabbos Kehilchoso 20: n.127). Either way, they cannot be touched and removed directly, by taking them out of the pocket. However, they can be thrown out from the pocket indirectly, by shaking them out. (Tiltul mim hatzad).
If mistakenly, as a natural reaction he placed his hand in the pocket to see what’s in there and realizes it is a bill, once the bill is in his hand he can dispose of it without walking more than four amos. Although, this heter usually applies only when the muktze came to his hand in a permissible way, such as a utensil dedicated to prohibited works that was used for something allowed, and not to inherent muktze. (O.H. 308: 3, Mishna Berura ibid. 14). However, some Poskim permit when it involves a significant loss. (See Shemiras Shabbos K. ibid.). He may then, acting correctly, ask the mother to take the money back or just leave it in front of her.
If there is an eiruv, Poskim disagree whether one who is wearing a non-bosis garment with muktze in it, has to remove the muktze as soon as possible or not, and due to the loss involved may be permitted to carry it home and shake it out the pocket there. (See Mishna Berura 310: 29). Shemiras Shabbos Kehilchoso 20:75).

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a