This paper presents the cost optimization of a photovoltaic-powered electrodialysis reversal (PV-EDR) system for village-scale applications in rural India based on current component costs and performance. A PV-EDR alternative was explored because it requires half the specific energy (and thus half the power system cost), and reduces water wastage from 60% to less than 10%, compared to small-scale reverse osmosis (RO) systems for groundwater salinity levels commonly found in India. Through co-optimization of the PV and EDR subsystems, the optimal system was predicted to cost $23,420 (42% less than a system designed using conventional engineering practice). A key to the cost reduction was flexible water production that accommodates daily changes in solar irradiance with overproduction on sunny days and water buffer storage tanks. A sensitivity analysis revealed that the capital cost of the total system is most sensitive to membrane area; reducing membrane cost by 87% would half the system capital cost. The optimization method presented here, as well as the cost saving strategies of time-variant operation and load matching with solar irradiance availability, provide design strategies that are relevant to other PV-EDR architectures and general off-grid desalination applications.