Purana Jyotisha Sangraha · by Vyasa
Chapter 4 · Moon at Prabhasa, Mars at Kashi
शिवपुराणम् : कालज्ञानम् उत्पाताः ग्रहक्षेत्राणि च
ततश्चन्द्रेण सद्भक्त्या संस्तुतश्शंकरः पुरा ।निराकारश्च साकारः पुनश्चैवाभवत्प्रभुः ॥ ४९ ॥
From the Shiva Purana, print Kotirudra Samhita ch 14, verse 49.
Then the Moon praised Shankara long ago with true devotion. The Lord, who has no form, took form again.
Simple meaning: The text says Shiva, though formless, took a form for the Moon's devotion.
प्रसन्नश्च स देवानां क्षेत्रमाहात्म्यहेतवे ।
The text says Shiva took the Moon's name there, for the Moon's fame.
सोमेश्वरश्च नाम्नासीद्विख्यातो भुवनत्रये ।
The text says worship at Someshvara may heal wasting sickness and leprosy.
धन्योऽयं कृतकृत्योऽयं यन्नाम्ना शंकरस्स्वयम् ।
The text says the Moon is blessed because Shiva stays there in his name.