Not all online pharmacies are illegal. Think of companies shipping stuff like catheters, diabetic supplies, oxygen equipment....many of those require a prescription.
Online contact lens sellers (at least ones I've used) do verify your prescription. Is it up to FedEx to investigate whether their customers are required to and actually do verify prescriptions?