There are two separate groups of customers for fuel: private individuals and commercial businesses.
The drivers of most vehicles used for business are not paying for the fuel themselves, so they are more influenced by the convenience of using fuel stations that are easy to find and are on the routes that they are already driving - i.e. on main roads.
In the UK, fuel prices are often higher on motorways than on other main roads, because commercial drivers using a motorway for high speed journeys are not going to waste time by leaving the motorway to buy fuel and then returning to it.
On the other hand private individuals are more likely to search out cheap fuel, especially if they can buy it easily while making some other car journey.
That explains why in the UK, the large supermarket chains sell relatively cheap fuel compared with "main road" prices. Most private motorists regularly visit supermarkets by car to shop, and while they are there it is convenient to buy fuel as well. The supermarket needs a large area of land for the store itself and for car parking, and the extra space needed for a fuel station is small. They can offset the reduced profit margin from their cheaper fuel price by the increase in sales volume, and encourage customer loyalty by including fuel sales on their store loyalty cards and similar promotional offers.
Incidentally, non-commercial professional drivers sometimes do search out cheap fuel. At my local supermarket, it's quite common to see a police car, and sometimes even an ambulance, filling up at the pumps.