This was discussed under the topic, “Jhana and magga pala“.
More information at the post, “Mundane versus Supramundane Jhāna“.
I think the sutta that is discussed at the end of that post is similar to the MN52 that you mentioned, Johnny.
Key facts to keep in mind:
1. Anariya jhana attained by focusing on a worldly object like breath or kasina. Ariya jhana attained by taking the “seen Nibbana” as the thought object: “etan santan etan paneetan…”.
2. Thus one has to have “seen” Nibbana (i.e., one must be at least a Sotapanna) to take Nibbana as the thought object (which means the “cooling down one has seen”).
3. One gets to anariya jhana by SUPPRESSING pancanivarana. A Sotapanna has REMOVED pancanivarana.
4. Of course, one who has anariya jhana can make it an Ariya jhana by comprehending the Tilakkhana and seeing the futility of jhanic pleasures.
5. A Sotapanna who gets to the first anariya jhana has not removed kama raga. But he/she will not come back to the kama loka (will get theAnagami phala moment in the brahma loka and attain Nibbana there). So, he/she is still an Anagami (“na” + “agami” or not coming back). This is what is stated in the last bullet in “Mundane versus Supramundane Jhāna“.