Answering the narrow version, because the broad one does not have a single answer. They are two different exemptions from the same federal requirements and they buy different things. A 503A pharmacy is regulated primarily by the state board, needs a patient-specific prescription, is exempt from CGMP, and may use a bulk substance that has a USP monograph, is a component of an approved drug, or appears on the 503A bulks list — three independent doorways. A 503B outsourcing facility registers with the FDA, is inspected on a risk basis, must comply with CGMP, may compound for office stock without a patient-specific prescription, and has one doorway to a permitted bulk substance: the 503B bulks list, or the drug shortage list.
If somebody has the primary source to hand I would rather cite it than paraphrase it.