In DN 13 the Buddha is teaching the path that leads to Brahmā, but not to a Brahmā, but to a brahmin (after first describing what doesn’t lead to Brahmā):
4. Teaching the Path to Brahmā
The Buddha said this:
“It’s when a Realized One arises in the world, perfected, a fully awakened Buddha … That’s how a mendicant is accomplished in ethics. … Seeing that the hindrances have been given up in them, joy springs up. Being joyful, rapture springs up. When the mind is full of rapture, the body becomes tranquil. When the body is tranquil, they feel bliss. And when blissful, the mind becomes immersed.
They meditate spreading a heart full of love to one direction, and to the second, and to the third, and to the fourth. In the same way above, below, across, everywhere, all around, they spread a heart full of love to the whole world—abundant, expansive, limitless, free of enmity and ill will.
Suppose there was a powerful horn blower. They’d easily make themselves heard in the four directions. In the same way, when the heart’s release by love has been developed and cultivated like this, any limited deeds they’ve done don’t remain or persist there. This is a path to companionship with Brahmā.
Furthermore, a mendicant meditates spreading a heart full of compassion …
They meditate spreading a heart full of rejoicing …
They meditate spreading a heart full of equanimity to one direction, and to the second, and to the third, and to the fourth. In the same way above, below, across, everywhere, all around, they spread a heart full of equanimity to the whole world—abundant, expansive, limitless, free of enmity and ill will.
Suppose there was a powerful horn blower. They’d easily make themselves heard in the four directions. In the same way, when the heart’s release by equanimity has been developed and cultivated like this, any limited deeds they’ve done don’t remain or persist there. This too is a path to companionship with Brahmā.
What do you think, Vāseṭṭha? When a mendicant meditates like this, are they possessive or not?”
“They are not.”
“Is their heart full of enmity or not?”
“It is not.”
“Is their heart full of ill will or not?”
“It is not.”
“Is their heart corrupted or not?”
“It is not.”
“Do they wield power or not?”
“They do.”
“So it seems that that mendicant is not possessive, and neither is Brahmā. Would a mendicant who is not possessive come together and converge with Brahmā, who isn’t possessive?”
“Yes, Master Gotama.”
“Good, Vāseṭṭha! It’s possible that a mendicant who is not possessive will, when the body breaks up, after death, be reborn in the company of Brahmā, who isn’t possessive.
And it seems that that mendicant has no enmity, ill will, corruption, and does wield power, while Brahmā is the same in all these things. Would a mendicant who is the same as Brahmā in all things come together and converge with him?”
“Yes, Master Gotama.”
“Good, Vāseṭṭha! It’s possible that that mendicant will, when the body breaks up, after death, be reborn in the company of Brahmā.”
Yes, that too is an explanation how Brahmā Baka got where he is now; but less systematic than the one mentioned above.
What precepts and observances did I practice in the past?
Explain to me so I can understand.”
“You gave drink to many people
who were oppressed by thirst and heat.
They’re the precepts and observances you practiced in the past.
I recollect it like one who has wakened from sleep.
When people at Deer River Bank were seized,
you released the captives as they were led away.
That’s the precepts and observances you practiced in the past.
I recollect it like one who has wakened from sleep.
When a boat on the Ganges River was seized
by a fierce dragon desiring human flesh,
you freed it wielding mighty force.
That’s the precepts and observances you practiced in the past.
I recollect it like one who has wakened from sleep.
I used to be your servant named Kappa.
You thought he was intelligent and loyal.
That’s the precepts and observances you practiced in the past.
I recollect it like one who has wakened from sleep.”