Usually I try to be more careful with my wording.

"Better sound" is subjective and some people like the sound of vinyl and that's OK with me. But
technically (noise, distortion, and frequency response*) digital is better.
On vinyl you can always hear backgroiund noise between tracks and sometimes during quiet parts. And the "snap", "crackle", and "pop" can sometimes be very bad! I could live with the low-level noise on a good record (if I had to) but the clicks & pops always annoyed me.
LPs sometimes often use the same master, or sometimes there is
additional mastering-processing to accommodate vinyl. Sometimes the vinyl is less compressed but you can't count on it.
There's no limit to how much you can compress with either format. Of course you can put a test-tone with zero dynamics on a record.
There are loudness limits but they aren't as strictly defined as digital... As you make vinyl louder it may become harder to track with some cartridges and the grooves get wider so you can't fit as much music on a side.
And simple "DR" measurements can be misleading because vinyl cutting and playback boosts some peaks and reduces others without changing the sound of the dynamics. The new higher peaks "measure" like more dynamic range but they don't sound louder. MP3 compression has a similar effect so often the MP3 will also "measure better" than the CD it was ripped from.**
CDs have about 30dB more dynamic range capability (because of the noise on records). And dynamic compression reduces the dynamic range ("dynamic contrast") so "loudness war" compression is no problem on a record. (In the analog days, they had, and used, analog compression and loudness wars but it usually wasn't as bad because they didn't have the modern digital "weapons".
* The frequency response on vinyl can extend beyond CDs into the ultrasonic range, but CDs are flatter over the audio range.
** MP3 actually has more dynamic range
capability than 16-bit audio! MP3 can go over 0dB (I don't think there's a hard-limit) and it can go quieter where the 16-bit data drops to dead silence (digital zeros). But of course it's lossy so it's not a good trade-off. And it doesn't help to go over 0dB since DACs are limited to 0dB