I believe you refer to the concentration cell. The only source of the energy is the concentration difference - when the concentrations are identical, system is at equilibrium, so there is no reason for the oxidation/reduction reaction (same reaction, just going in different directions) to proceed. This is thermodynamics 101.
Basically every source of energy requires some kind of a gradient/difference. If there is no parameter that is different for two parts/states of the system, system is at equilibrium and there is no energy to be gathered.
Reasonably good analogy are two communicating vessels - when there is a liquid level difference, liquid will flow till the level is identical in both vessels. That's the same what happens in the concentration cell - flowing current is a way of "transferring concentration" between cells and will stop flowing once the concentration becomes identical. Level difference of liquid in communicating vessels is the equivalent of the potential difference between cells with different concentrations.