What gets removed
The EXIF block, which holds GPS, camera, lens and owner information. Any XMP block written by an editor. The Photoshop IPTC record. Free-text comment segments. The embedded preview thumbnail, which can otherwise show a pre-crop version of the image.
What stays
The image itself, byte for byte. A JPEG is a sequence of labelled segments, and the compressed picture data is one of them. Removing the others does not touch it, so there is no re-encoding and no quality loss of any kind.
Why not just re-save it
Re-saving through an image editor does strip metadata, but it also re-compresses the picture and loses a little quality each time. Removing the segments directly avoids that entirely.