Even if it costs more energy to produce a gallon of gasoline than is contained in a gallon of gasoline, it can still make sense to produce it.
Think of the “hydrogen economy” that people like to talk about. There isn’t any hydrogen sitting around underground for us to pump out, every drop of hydrogen would have to be manufactured. That means it will always cost more energy to produce a unit of hydrogen than you can recover by burning that hydrogen.
So that hydrogen isn’t an energy source, it’s a way of storing and transporting and using energy. And gasoline can be thought of the same way. You could mine coal, load it into trains, deliver the coal all over the country, and people could drive steam powered cars, like they had in the early 1900s. Or you could take coal, burn the coal at a central location, generate steam, drive turbines, generate electricity, transmit the energy to houses, plug car batteries into the houses, and charge electric cars. Or you could take the coal, burn it, generate electricity, and create hydrogen, transport the hydrogen around the country, and burn the hydrogen in hydrogen powered cars. Or you could take the coal, and convert it to liquid hydrocarbons, and transport the resulting fuel all over the country and burn it in conventional cars.
The advantage of coal-to-liquid is that we can use our existing transportation fleet, and don’t have to build millions of new vehicles. Of course, the resulting fuel is going to cost more than conventional gasoline, if it were cheaper we’d be doing it already. It would cost a lot to build these plants, and gasoline will have to hit a very high price and stay there for a long time before anyone would want to build a coal-to-liquid plant, because if the price drops you’ve got a very expensive factory that loses money like crazy.
The point is, the energy from crude oil is just one component of the value of gasoline. The other part is that liquid fuels are easy to work with for obvious reasons, and we already have a massive capital investment in liquid fuels. So even if liquid fuels become a net energy sink rather than an energy source, it can still make sense to manufacture them.