In Al-Fawaaid Ad-daraaree, Al-Ajloonee related that Imam Bukhaaree (may Allah have mercy on him) once travelled by boat on a journey to seek out knowledge and that he had taken with him one-thousand dinars. One of his fellow travelers ingratiated himself with Imam Bukharee, outwadly showing him love and admiration. During the sea-voyage, the man often made it a point to sit in his company. On long journeys, friendships develop faster than normal, and during the course of the time they spent together, Imam Bukhaaree informed the man that he had one-thousand dinars with him.
The morning after Imam Bukharee spoke about the money, the man woke up and began to cry, scream, rip his clothing apart, and slap his own face, as if he had just been afflicted with a great loss. His fellow shipmates asked him what was wrong, and he refused to answer at first, as if he was still in a state of shock and could not bring himself to speak about his situation. After they continually insisted that he tell them what the matter was with him, he finally said, “I had a bag that contained one-thousand dinars, and I lost it.”
The crewmen who were incharge of the ship began to search the passengers. One by one everyone was being searched, and upon realizing what was happening, Imam Bukharee, making sure that no one was looking, threw his bag of money over the side of the ship. When it was his turn to be searched, nothing was found. When the entire ship and all of its passengers were searched, and when no bag of money was found, those in authority on the ship went back to the man who had made up the story and chastised him for making a false claim and for putting them through so much trouble. As soon as the ship finally reached shore, the passengers began to disembark;meanwhile, Imam Bukhaaree’s old friend went to him and asked him what he had done with the bag of money.
“I threw it into the sea,” Imam Bukhaaree matter-of-factly replied.
“And you are patiently accepting the fact that you have just lost such a huge sum of money?” the man asked in bewilderment.
“O ignorant one,” Imam Bukhaaree said,
“Do you not know that I have spent my entire life gathering the Ahadeeth of the Messenger (Sallalaahu alaihi wa Sallam) and that the world now acknowledges my trustworthiness. Would it then have been befitting for me to subject myself to the accusation of theft? And shall I lose the precious pearl (i.e my knowledge and achievements as a scholar) that I have earned over a lifetime over a limited number of dinars?”
 Refer Al-Fawaaid Ad-Daraaree As-Sujloonee, and to Seerathul Bukhaaree by Al-Mubaarakpooree
Source: The Boigraphy of Imaam Bukhaaree (May Allah have mercy on him), published by dar-us-salam. pg 143-144