The Jataka, Vol. IV, tr. by W.H.D. Rouse, , at sacred-texts.com
"O king of men," etc. This story the Master told while dwelling at Jetavana about the boons received by Elder Ānanda. During the twenty years of his first Buddhahood the Blessed One's attendants were not always the same: sometimes Elder Nāgasamāla, sometimes Nāgita, Upavāṇa, Sunakkhatta, Cunda, Sāgala, sometimes Meghiya waited upon the Blessed One. One day the Blessed One said to the Brethren: "Now I am old, Brethren: and when I say, Let us go in this way, some of the Brotherhood go by another way, some drop my bowl and robe on the ground. Choose out one Brother to attend always upon me." Then they uprose all, beginning with Elder Sāriputta, and laid their joined hands to their heads, crying, "I will serve you, Sir, I will serve you!" But he refused them, saying, "Your prayer is forestalled! enough." Then the Brethren said to the Elder Ānanda, "Do you, friend, ask for the post of attendant." The Elder said, "If the Blessed One will not give me the robe which he himself has received, if he will not give me his dole of food, if he will not grant me to dwell in the same fragrant cell, if he will not have me with him to go where he is invited: but if the Blessed One will go with me where I am invited, if I shall be granted to introduce the company at the moment of coming, which comes from foreign parts and foreign countries to see the Blessed One,  if I shall be granted to approach the Blessed One as soon as doubt shall arise, if whenever the Blessed One shall discourse in my absence he will repeat his discourse to me as soon as I shall return: then I will attend upon the Blessed One." These eight boons he craved, four negative and four positive. And the Blessed One granted them to him.
After that he attended continually upon his Master for five and twenty years. So having obtained the preeminence in the five points 1, and having gained seven blessings, blessing of doctrine, blessing of instruction, blessing of the knowledge of causes, blessing of inquiry as to one's good, blessing of dwelling in a holy place, blessing of enlightened devotion, blessing of potential Buddhahood, in the presence of the Buddha he received the heritage of eight boons, and became famous in the Buddha's religion, and shone as the moon in the heavens.
One day they began to talk about it in the Hall of Truth: "Friend, the Tathāgata has satisfied Elder Ānanda by granting his boons." The Master entered, and asked, "What are you speaking of, Brethren, as ye sit here?" They told him. Then he said, "It is not now the first time, Brethren, but in former days as now I satisfied Ānanda with a boon; in former days, as now, whatsoever he asked, I gave him." And so saying, he told a story of the past.
Once upon a time, when Brahmadatta reigned in Benares, a son of his named Prince Juṇha, or the Moonlight Prince, was studying at Takkasilā. One night, after he had been listening carefully to his teacher's instruction, he left the house of his teacher in the dark, and set out for home. A certain brahmin had been seeking alms, and was going home, and the prince not perceiving him ran up against the brahmin, and broke his alms bowl with a blow of his arm. The brahmin fell, with a cry. In compassion the prince turned round, and taking hold of the man's hands raised him to his feet. The brahmin said, "Now, my son, you have broken my alms-bowl, so give me the price of a meal." Said the Prince, "I cannot now give you the price of a meal, brahmin; but I am Prince Juṇha, son of the king of Kāsi, and when I come to my kingdom, you may come to me and ask for the money."
When his education was finished, he took leave of his teacher, and returning to Benares, showed his father what he had learnt.
"I have seen my son before my death," said the king, "and I will see him king indeed." Then he sprinkled him and made him king.  Under the name of King Juṇha the prince ruled in righteousness. When the brahmin heard of it, he thought now he would recover the price of his meal. So to Benares he came, and saw the city all decorated, and the king moving in solemn procession right-wise around it. Taking his stand upon a high place, the brahmin stretched out his hand, and cried, "Victory to the king!" The king passed by without looking at him. When the brahmin found that he was not noticed, he asked an explanation by repeating the first stanza:
Not without cause have I come here this day.
’Tis said, O best of men, one should not pass
A wandering brahmin standing in the way."
On hearing these words the king turned back the elephant with his jewelled goad 1, and repeated the second stanza:
What cause it is has brought you here to-day?
What boon is it that you would crave of me
That you are come to see me? speak, I pray!"
What further king and brahmin said to each other by way of question and answer, is told in the remaining stanzas:
 "Hast thou a penance, brahmin, dread to tell, "No penance have I, nor no charm and spell, "I cannot call to mind, in time past o’er, "In the fair city of Gandhāra's king, "And as we both were standing there, O prince, "Whenever, brahmin, a wise man has met "’Tis fools deny the thing once done, and let "But trusty men cannot forget the past, "Five villages I give thee, choice and fine,
A hundred slave-girls, seven hundred kine,
More than a thousand ornaments of gold,
And two wives give me, of like birth with mine."
Or hast thou many a charm and many a spell,
Or goblins, ready your behests to do,
Or any claim for having served me well?"
No demons ready to obey me well,
Nor any meed for service can I claim;
But we have met before, the truth to tell."
That I have ever seen thy face before.
Tell me, I beg thee, tell this thing to me,
When have we met, or where, in days of yore?"
Takkasilā, my lord, was our dwelling.
There in the pitchy darkness of the night
Shoulder to shoulder thou and I did fling.
A friendly talk between us straight begins.
Then we together met, and only then,
Nor ever once before, nor ever since."
A good man in the world, he should not let
Friendship once made or old acquaintance go
For nothing, nor the thing once done forget.
Old friendships fail of those they once have met.
Many a deed of fools to nothing comes,
They are ungrateful, and they can forget.
Their friendship and acquaintance ever fast.
 A trifle done by such is not disowned:
Thus trusty men are grateful to the last.
A hundred slave-girls, and seven hundred kine,
More than a thousand ornaments of gold,
And more, two wives of equal birth with thine."
 "Hast thou a penance, brahmin, dread to tell,
"No penance have I, nor no charm and spell,
"I cannot call to mind, in time past o’er,
"In the fair city of Gandhāra's king,
"And as we both were standing there, O prince,
"Whenever, brahmin, a wise man has met
"’Tis fools deny the thing once done, and let
"But trusty men cannot forget the past,
"Five villages I give thee, choice and fine,
As the full moon among the stars we see,
Even so, O Lord of Kāsi, so am I,
Now thou hast kept the bargain made with me."
 The Bodhisatta added great honour to him.
When the Master had ended this discourse, he said, "This is not the first time, Brethren, that I have satisfied Ānanda with boons, but I have done it before." With these words, he identified the Birth: "At that time Ānanda was the brahmin, and I was myself the king."
61:1 R. Fick, Sociale Gliederung im Nordöstlichen Indien zu Buddha's Zeit, p. 119.
62:1 Are these the Five abhabbatthānas?
63:1 Correct ii. 253. 19 to "jewelled goad"