See this footnote to the section on Audio Formats at HomePod - Technical Specifications - Apple:
AirPlay is used to stream content on iPhone to HomePod. Transcoding to a lossy format for streaming may occur.
It is possible that whether transcoding is required, and what quality is used for the stream, might depend of the quality of service of your Wi-Fi. If there is a fixed algorithm haven't seen it shared it publicly. I'm not certain I could tell the difference in my very brief attempt to test. Unfortunately I live on a main road and not everyone in my house likes my music. 😟 In my case I have the same Apple Music tracks on my phone as I would be calling up on the HomePod. Perversely the difference might be more significant if you high quality originals synced to the phone, since they would definitely need transcoding, and the transcoder is going to have to be better than real time.