She doesn’t turn into sea foam though, she turns into an air spirit, getting the chance of an immortal soul, which is what she was after.

I clearly remember the version I read having her throw herself off of a cliff and turn into sea foam. It was a very sad ending that stuck with me.

It must have been an abridged version or something that skipped the redemption arc, like this:

"In the end, the Prince marries another, a girl he thinks is the girl that saved him, but of course, isn’t. And the little mermaid is given the opportunity to win back her life with her family, to return to life as a mermaid, if she can kill the Prince as he sleeps. But, she loves him, and so she can’t.

Instead as part of the bargain she made with the sea witch, she dies, turning into sea foam."

That left off the redemption arc:

But here, Andersen is able to deliver the ultimate judgment. Instead of simply perishing as sea foam as other mermaids do (we are told earlier that, unlike humans, mermaids do not have afterlives), the little mermaid becomes a daughter of the air. In exchange for her goodness, for her suffering, and her loyalty, she is given the chance to win immortality, to win an immortal soul.

https://thecuriousworthy.com/2017/03/30/the-original-little-...