The pharmacist does not report to the FAA, but when you sign your medical application, you have given the FAA permission to access all your medical records, and the record of the prescription will be there. Of course, you are only required to report medications you are currently taking, not those you have taken in the past, but you are required to report pretty much any medical condition you ever had for which the prescribed medication would disturb the FAA Aeromedical people, and the meds will then come into the discussion. One supposes you could lie and conceal your medical history, but the FAA usually seems to find out about it, and then you lose all your FAA certificates and can potentially be charged with a Federal criminal felony offense -- unwise, I think.
Best bet in the long run is to fill out the form honestly and accurately -- in most cases, past meds won't be a problem as long as the underlying condition has been resolved.