Difference between PCS and PMA loopback in transceivers
Figure 2-28 from chapter 2 of Xilinx UG578 GTY transceiver user guide:

There are four types of loopback: near-end PCS, near-end PMA, far-end PCS, and far-end PMA.  The figure indicates where each of these loopbacks are implemented.  The different loopbacks enable different segments of the link.  The near-end loopback modes do not test the actual link, only the transceiver logic, while the far-end loopback modes test the link and some portion of the transceiver logic on the link partner at the far end of the link.
Near-end PCS loopback: only physical coding sublayer (PCS) portion of local transmitter and receiver are active.  Basically, the loopback is implemented immediately before the actual serializer, so this only tests the digital portion of the transceiver logic, which is generally the line coding, comma insertion, elastic buffers, etc.
Near-end PMA loopback: PCS and physical medium attachment sublayer (PMA) portion of the local transmitter and receiver are active.  Basically, the loopback directly connects the transceiver high speed data output back to the input internally, so this tests the serializer, deserializer, and clock-data recovery (CDR) components in addition to the PCS logic.
Far-end PMA loopback: PMA portion of remote transmitter and receiver are active in addition to the local transmitter and receiver.  This is the first loopback mode that actually tests the link.  In this case, the loopback is performed on the parallel data coming out of the deserializer, looping it directly back to the serializer.  In this case, the CTLE, DFE, CDR, deserializer, serializer, and output driver including deemphasis will be active at both ends of the link, in addition to the near-end PCS.
Far-end PCS loopback: full transmitter and receiver on both ends of the link is active.  This mode tests all of the transceiver logic on both ends of the link, including two back-to-back passes through the PCS at the far end of the link, which will decode and then re-encode the line code.