Why does the idiom "Jig is up" mean "discovered in the act of dishonesty"?

'X is up' is an idiom meaning 'X is finished'

'the jig is up' is also an idiom

Definition of the jig is up

US, informal + old-fashioned

—used to say that a dishonest plan or activity has been discovered and will not be allowed to continue

The jig is up: where did you hide the stolen goods?

(M-W)


Etymology

Jig is an old term for a lively dance, and in the Elizabethan era the word also became slang for a practical joke or a trick. This idiom derives from this obsolete slang word.

(Wiktionary)


From Green’s Dictionary of Slang:

Jig:

  • late 16C SE, a comical performance, usu. given in the interval or at the conclusion of a play.

Jig is up/over:

(also jigg) a trick, a swindle; thus as verb, to trick; jigger noun, a swindler; thus the jig is up/over, the game is up:

  • 1611 - J. Cook Greenes Tu Quoque Scene xvi: Why but what Jigge is this?

  • 1777 - Maryland Journal 17 June n.p.: Mr. John Miller came in and said, ‘The jig is over with us.’.


According to Merriam-Webster's Dictionary https://www.merriam-webster.com/dictionary/jig:

JIG

noun

1a: any of several lively springy dances in triple rhythm

1b: music to which a jig may be danced

2: TRICK, GAME —used chiefly in the phrase the jig is up

The definition follows the entry from Etymologyonline:

The name of the dance was the first meaning of the word. From 1580s JIG is used as the music for such a dance. The extended sense "piece of sport, trick" (1590s), survives mainly in the phrase the jig is up (first attested 1777 as the jig is over).

According to Merriam-Webster's Dictionary https://www.merriam-webster.com/dictionary/up:

UP

at an end // your time is up

So, the original meaning of the idiom is 'the trick or the game has finished; everything's clear'.

As TRICK usually some negative connotation (according to MWD: ''a crafty procedure or practice meant to deceive or defraud'' https://www.merriam-webster.com/dictionary/trick), hence the modern meaning.