Just saw this article posted on CNet: https://www.cnet.com/home/kitchen-and-household/dont-buy-distilled-water-save-money-and-make-it-yourself-in-5-easy-steps/ It shows you how to save money using a pot inside a pot, with an ice-filled domed lid upside down over them, over a kitchen-range gas burner, to make your own distilled water at something like 48 minutes a cup. I'm too lazy to do the math, but I'm thinking the gallon at the grocery store doesn't sound like such a bad deal.
Clever, if you really need distilled water, and can't get to the store. There are countertop distillers that can do the job while making better use of the electricity. The gallon jugs probably still come out ahead. If you need large amounts of pure water, say for an aquarium, you are better off with a deionization or reverse osmosis system.