Buying is actually the highest priority; it is just that selling is the lowest one, so that you would see the energy capped instead of hovering somewhere lower.
Well, when I returned to the game after a few hours of absence, money was at zero, all my power plants were disabled and my population was plummeting.
I don't remember if the energy was capped; even if it was, it didn't help because you still have to manually sell it to get money. Considering that you need money to buy resources, the real buying priority is always below the priority of selling. If you can't sell, you can't buy.
My point is that with this being an idle game, there is an expectation that when you return to it after some time you'll have more resources to buy upgrades. It's strange for an idle game to punish for idling with the loss of progress.
Actually, it is an incremental game. While many incremental games are idle games, not all are.
But anyhow, I already figured out how to fix the issue you encountered: Lower the rate you are sending to the other city to about half of your average production (actual production--so if the crank is the only one producing, only calculate half of that; do not include production for power plants that are not producing due to no fuel). Once you start storing the unsold/unsent energy, it will fill your storage and kick start the selling again (make sure you have an engineer assigned to sell, though!) And then stick to that... Figure out how much energy you produce *on average since it fluctuates*, and set your "send rate" lower than that. That way, a part of your production always gets sold off to pay for buying.
Worse case scenario is if it tanked to zero while you were away--just set your send rate to zero. It will fill your storage (from the hand crank, at least) and start selling the excess. Once it starts selling, it will also start buying and bringing the other power plants back online. Then you can slowly start raising the send amount again.
Just remember not to send or store all your production--you will always want to ensure a portion is being sold off to pay for fuel buying. I've had good results with treating my main production as if it were 15% less for main power plants, and only about half for alternative power sources which can drop to zero production at times. That way, it send the remainder in to storage and sells off the excess after storage is full. (My storage levels were under 10 storage facilities for a long time to encourage hem to fill quickly and start selling. Only recently have I increased it in order to meet the end game target levels.)