The various versions of the story were borrowed by just about everybody, including the Buddhists. Monika Zin’s lengthy paper, The Parable of “The Man in the Well”. Its Travels and its Pictorial Traditions from Amaravati to Today will tell you more about it than you ever wanted to know:
The parable of ‘The Man in the Well’ was the object of Indological research long before Vogel, as part of the 19th century vogue for comparative studies of literary motifs, and the story was therefore known in Europe. Friedrich Rückert, the pioneer of Oriental Studies and also a popular German poet, published the translation of the parable in 1823 based on the poem of the 13th century Persian Sufi mystic, Rûmî (cf. infra, p. 54). Rückert’s poem made the parable commonly known in Germany and shortly afterwards other versions began to circulate, including versions from India.
In 1859 Theodor Benfey, followed in 1860 by Felix Liebrecht and in 1888 by Ernst Kuhn, was able to deliver the first summing up about the spreading of the parable. Kuhn (1888: 70) demonstrated beyond any doubt that the parable originally came from India since its elements were known from earlier Indian sources: the chase by an elephant and the fall into a pit were already referred to as similes in the Brhadāranyakopanisad. Today, our knowledge about the parable is more extensive: we know that it is rendered in the Mahābhārata, in four Jaina sources, namely in the Vasudevahindi of Sanghadāsa, in the Samarāicca-kahā of Haribhadra, in the Parisista-parvan of Hemacandra and in the Dharma-parīksā of Amitagati.
The Buddhist sources did not survive in Indian languages but we have six Chinese translations, namely T 208 (Nj. 1366: ‘The Samyuktāvadāna-sūtra, selected from various sūtras, of Kumārajiva’, 405 CE), T 217 (Nj. 735: ‘Sūtra spoken by Buddha on [eight] comparisons’), T 1690 (Nj. 1347: ‘Sūtra on the cause [Nidāna] of the preaching of the law [delivered] by Pindola Bharadvāja to King Udayana’ of Gunabhadra, 435–443 CE), T 2121 (Nj. 1473: ‘[A collection of extracts] on different subjects from Sūtras and Vinaya works’, compiled by San-min, 516 CE), T 2122 (Nj. 1482: ‘Pearl-grove of the garden of the law’, compiled by Tao shi, 668 CE) and T 2131 (Nj. 1640: ‘A collection of the meanings of the [Sanskrit] names translated [into Chinese]’ of Fa-yun, 1151 CE). There is also one Tibetan version, but it is very different from the Indian one.
The sources differ from one another in the presence or absence of particular elements of the parable and through the explanation of the allegory.