I think that this:
"Where neither water nor yet earth Nor fire nor air gain a foothold, There gleam no stars, no sun sheds light, There shines no moon, yet there no darkness
reigns. When a sage, a brahman, has come to know this For himself through his own wisdom, Then he is freed from form and formless. Freed from pleasure and from pain."
was said and meant to be understood relative to this which is from the same sutta:
"Herein, Bahiya, you should train yourself thus: 'In the seen will be merely what is seen; in the heard will be merely what is heard; in the sensed will be merely what is sensed; in the cognized will be merely what is cognized.' In this way you should train yourself, Bahiya.
"When, Bahiya, for you in the seen is merely what is seen... in the cognized is merely what is cognized, then, Bahiya, you will not be 'with that.' When, Bahiya, you are not 'with that,' then, Bahiya, you will not be 'in that.' When, Bahiya, you are not 'in that,' then, Bahiya, you will be neither here nor beyond nor in between the two. Just this is the end of suffering."
Now through this brief Dhamma teaching of the Lord the mind of Bahiya of the Bark-cloth was immediately freed from the taints without grasping. Then the Lord, having instructed Bahiya with this brief instruction, went away."
So.....my view is that the first (poetic) excerpt refers to "the end of suffering"....and however one wants to interpret the end of suffering is what is being suggested. Another point in my view is that if one wants to determine if the poetic excerpt refers to Bahiya then one must determine what is meant by being "freed from the taints without grasping".....seems like alot of different people have different views about where these two phrases ("the end of suffering" and "freed from the taints without grasping") fit into the detailed analysis of all those things associated with awakening since there is not just one clear understanding of it.....my own view is that it is not important....that what is being described is so beyond the every day conditions of most people and so close to the goal that analysing it in minute detail is of little interest....my view only.
Also....my view on this teaching is that it is saying that when a sage has come to know for himself through his own wisdom that the fabrications representing things that we assume to be part of physical reality (sun, moon, water, earth, fire, stars) no longer arise the result is not darkness, dispair, dukkha....but rather it bring the condition of being freed from form and formless. Freed from pleasure and from pain.(to paraphrase: when our views on the existence of an external reality are abandoned completely the result is not dukkha but freedom)
Also...in another thread I have been trying to get an understanding of the idea of "two truths" and I'm wondering if the two sutta excerpts which I have offered above together are an example of the "two truths" notion being presented in one sutta.