For roughly a century and a half, the Vatican tried to keep Allegri's Miserere a Sistine Chapel exclusive by the simplest means available: forbidding anyone to write it down. Under Pope Urban VIII, transcribing the piece outside the chapel carried the threat of excommunication, a genuinely severe penalty that nonetheless failed to stop a slow trickle of copies leaving Rome over the decades, some smuggled out by visiting musicians, at least one reportedly obtained by Britain's King Charles I via a diplomatic request.
None of that trickle mattered as much to the piece's eventual wide circulation as a single afternoon in April 1770, when fourteen-year-old Wolfgang Amadeus Mozart, touring Italy with his father Leopold, attended the Wednesday Tenebrae service in the Sistine Chapel and heard the Miserere performed once. That evening, back at his lodgings, he wrote the entire nine-voice piece out from memory. He returned to the Sistine Chapel on Good Friday, when it was performed again, and made small corrections to his transcript against that second hearing, reportedly hiding the manuscript in his hat to check it against the live performance without being seen.
Word of the feat reached Pope Clement XIV, who, by most accounts of the episode, was sufficiently impressed by a fourteen-year-old outwitting a century-old Vatican secrecy rule that he summoned Mozart to Rome and praised him rather than pursuing any penalty, and the transcription was published the following year in London by the historian Charles Burney, effectively ending the piece's long run as a closely guarded Vatican exclusive.