In Talmudic times, it was customary for Jews and gentiles to play musical instruments during a funeral procession to intensify the feeling of mourning. It is apparent from the discussion in the Gemara that flutes were an essential component in preparing to bury the dead in an honorable fashion. The Mishna teaches:
One may wait for nightfall at the Shabbat boundary to attend to the needs of a bride and the needs of a corpse, such as to bring him a coffin and shrouds. If a gentile brought flutes on Shabbat in order to play music during the eulogy and funeral procession, a Jew may not eulogize with them as accompaniment, unless they were brought from a nearby location within the Shabbat boundary and transporting them did not include any violation of halakha.
The prohibition of amira le-akum – asking a non-Jew to perform forbidden Shabbat activities – is a complicated question. According to the Mekhilta there may be a Biblical prohibition involved, based on the passage in Sefer Shemot (12:16) that teaches that “no manner of work should be done in them” i.e., even if performed by a non-Jew. Nevertheless, the accepted ruling is that the prohibition is only of Rabbinic origin, an ordinance established in order to limit the possibility that a Jew will mistakenly perform a forbidden activity himself.
There are two separate issues that need to be dealt with in such cases:
1. Requesting that the non-Jew perform the forbidden action, and
2. Benefitting from a forbidden action that was performed by the non-Jew, even if no request is made.
In order to avoid these issues, the ruling in the case of our Mishna is that if a gentile brought flutes or anything else to be used for a Jewish burial on Shabbat, one must wait the amount of time that it takes to bring these objects from a nearby location before using them after Shabbat. If the location from which the objects were brought is known, one must wait the amount of time it takes to bring them from that specific place (Rambam Sefer Zemanim, Hilkhot Shabbat 6:5; Shulḥan Aruk, Oraḥ Ḥayyim 325:15).