Sludge is a by-product of municipal wastewater treatment plants (WWTPs) and its management contributes significantly to the operating costs. Large WWTPs usually have anaerobic sludge digesters to valorize sludge as methane and to reduce its mass. However, the low methane market price opens the possibility for generating other high value-added products from the organic matter in sludge, such as polyhydroxyalkanoates (PHAs). In this work, the economic feasibility of retrofitting two types of WWTPs to convert them into biofactories of crude PHAs was studied. Two cases were analyzed: (a) a large WWTP with anaerobic sludge digestion; and (b) a small WWTP where sludge is only dewatered. In a two-stage PHA-production system (biomass enrichment plus PHAs accumulation), the minimum PHAs cost would be 1.26 and 2.26 US$/kg PHA-crude for the large and small WWTPs, respectively. In a single-stage process, where a fraction of the secondary sludge (25%) is directly used to accumulate PHAs, the production costs would decrease by around 15.9% (small WWTPs) and 19.0% (large WWTPs), since capital costs associated with bioreactors decrease. Sensitivity analysis showed that the PHA/COD (Chemical Oxygen Demand) yield is the most crucial parameter affecting the production costs. The energy, methane, and sludge management prices also have an essential effect on the production costs, and their effect depends on the WWTP’s size.