Up until at least the mid 1970s (and possibly later), the British film censors would not allow general release of a film which depicted the bad guys winning (unless it was based on historic events). The logic being this could encourage member of the public to engage in criminal activity – believing they could also commit such a crime and get away with it.
I always understood this to be the reason for the film’s ending – at the time, the film censors would not have allowed Michael Caine and his gang to get away with the heist.