There is one critical difference.
Every impurity that develops in pharma peptides has to be specifically characterized and assessed for risk. Impurities that are high risk to health must be eliminated. All of this is heavily documented and reviewed by the FDA.
The types of impurities that could be present are specific to the pharma formulation, manufacturing method, packaging, and storage. If anything changes, the impurities have to be recharachterized and get FDA approval.
None of this occurs with underground lab produced peptides.