Chacham Y Faur has an article "DON QUIXOTE – TALMUDIST AND MUCHO MÁS"
In his words:
The purpose of the present study is to examine a story in Don Quixote II, 45 together with a passage in the Talmud, B. Ned. 25a
The essential facts are these. Someone loaned the sum of ten gold crowns to a friend without witnesses. The borrower admitted the loan but claimed to have repaid it in full. The creditor asks Sancho to put the debtor under oath. Before taking the oath the debtor hands over his staff, in which he had hidden the money, to the creditor. Unabashedly, he then proceeds to swear that he had returned the loan to the creditor
Typically, Faur goes to great length proving that Crevantes had a much greater understanding in the Gemara the the Rashba did, etc. ,etc. He notes that the story appears in older sources:
The motif of the reed as a tool of deception is already found in Livius I, 56,35 but in a completely
completely different context.
There seems to be a certain genre of story that passes from culture to culture and religion to religion with only minor changes to fit the context (see Parsha blogs excellent post on the subject here.) In fact, a quick search on Google gave me the following book Ariadne's Thread which has many versions of the "money in stick" story some of which parallel the Talmud's version exactly. Cervantes' source was probably one of the European versions.