Pharmacies can be paid in several ways by insurance companies, including a maximum allowable cost per generic drug, a capitation fee where the pharmacy receives a set amount per patient each month regardless of visits, and sharing costs with patients through deductibles and copayments. There are also different types of third party plans like HMOs that require providers and referrals in and out of network, PPOs that pay less for out of network care, and POS plans that require a primary care provider and referrals for specialists. Medicare, Medicaid, and workers compensation may also cover prescriptions, while patient assistance programs can help with affordability.