As others have said, they are to allow for loading, while avoiding door dings, don't think theres any reason they have to be close to the store, other than they should be adjacent a designated walkway, and the route to the shop should maximise the percentage of the route thats designated walkways, and minimise the number of roadway crossings - and generally this is easier to achieve with them close, it wouldn't rule out putting them close to the edge quite far down if there was a continous footpath to the entrance, but doesn't seem to be commonly done.
I do wish though that places would provide some wider spaces, for any others who could do with them for whatever reason that may be, maybe in the far corner of the car park. Whether thats because you want to avoid door dings on your car, or like me, are a larger chap who would like a bit more room to get out (Its worse when I'm in the van - its a big vehicle to start with, and the door cards seem to we very thick, I've backed into a space before and relised I havn't got a hope of getting out)