The energy is not generated cheaply at night. It basically costs the same. (The idea when to charge batteries is a misconception on /. You charge during peak times, see below.)
That peak energy is expensive has not much to do with generation pries, but with grid logistics.
Consider you have a load following coal plant running at lets say 75% during a peak period, does not really matter, lets say a random time between 10:00 and 17:00 (5PM for the americans).
Now for some reason you get an extra load on the grid, which you can not fulfill, so you have to increase yield of the above plant. Unfortunately you can not adapt your plant to the exact demand, the coal plant can only change its yield in lets say 2.5% steps.
So after you have increased the yield you are producing to much energy. So actually you burn more coal than you need to fulfill the demand.
Either you have to sell the extra energy, store it in a pumped storage or let it go to waste in a resistor at the power plant.
Regardless what you chose: it costs the energy company. Hence they demand a premium price for peak times.
The closer the plants are running at the exact demand of the grid, the more likely it is they mainly create costs instead of revenue when they increase their yield. Or when demand suddenly drops!
That is where smart meters and batteries or EVs come in
During peak time, when energy is supposedly expensive, charging batteries will prevent that problem. Hence smart meter owners with storage capacity will mainly charge during peak times, and not off peak, for a special low price, not for an expensive price.
Of course you are not simply charging constantly during peak times. The power plants or the grid operators will remote control your charging, so they can "balance" the grid with your batteries instead of using pumped storage or wasting the energy.