Thanks Greta I was trying to work out how to include a graphic file in a post to illustrate the problem but you pre-empted me!
As Greta says Apple use the M4A suffix for both ALAC (Apple Lossless Audio Codec) and AAC (Advanced Audio Coding ie lossy) files. Fortunately, on the Mac at least, iTunes/Apple Music can tell the difference between the two types of file in the "Kind" field. But the bottom line is you can't tell a file just by its suffix whether it be M4A, FLAC or WAV.
As an example take an MP3 file and load it into Audacity or any other audio editor. Without making any change to the file immediately save it as a WAV or FLAC. Because you haven't made any changes to the content of the file it still contains lossless data but is now masquerading as a FLAC or WAV file. So it is a fake. This process is called "upsampling". It doesn't improve the quality of the music data and just ends up with a much larger file.
The best way to check whether a file is a fake FLAC/WAV is to use an app like Spek, a screen grab from which Greta has posted above. If the frequencies suddenly cut off such as this one at 16kHz then the file is a lossy one. Sadly there's no way to come back from this because if you were now to convert the file to lossy format the additional compression will further degrade the quality of the sound. Spek is available for both Mac (which I use) and Windows. Though sometimes it is not always visually clear if a file has been upsampled. So in addition I use a Windows only app on an aging laptop called Lossless Audio Checker. It analyses music files and reports whether they have been upsampled or not. It was this app I used to check the share here:
https://librarymusicthemes.com/index.php?topic=8362.msg57359#msg57359.
You can find further info on this subject here
https://erikstechcorner.com/2020/09/how-to-check-if-your-flac-files-are-really-lossless/