Copyright laws for much of the 19th century were pretty much non-existant. This did nothing to discourage the practice of composers "borrowing" other composers' music, or their own, to make into dances.

Usually this was mutually beneficent. The dance composer did not have to think up the tunes and the original composer, usually of operas, got some publicity if his tunes were being played around the city in which the opera was being performed.

Credit was usually given. Sometimes the translation was better than the original. Sometimes you do think about the wisdom of transforming a serious opera into a dance.

The quadrille, with its requirement for lots of short tunes, was a frequent form used for this, but other forms, including general potpourris, were also used.