Why is this permissible? Because “a lamp for one is a lamp for a hundred” – that is, nothing is diminished by the Israelite’s use of a lamp already lit.
The rabbis investigate this concept further:
Come and hear: If a city inhabited by Israelites and Gentiles contains baths where there is bathing on the Sabbath, if the majority are Gentiles, [an Israelite] may bathe there immediately;
if the majority are Israelites, one must wait until [after the Sabbath when] hot water could be heated
Water heated for the benefit of a Gentile majority may be enjoyed by Israelites. But not if it is heated for the sake of the Israelites.