Why and when did "crack" come to mean "tell"?
Cracking jokes is to me the most familiar contextual usage of this term.
Why would anyone say they were cracking jokes, not just telling jokes?
There is a difference between "Crack" and "Tell" when it comes to jokes. To crack a joke is to make an original witty remark (i.e. something that, in context, is funny, but would not necessarily stand alone as humor); to tell a joke is to relate a bit of humor that is expected to be received well by your audience.
A sample of the difference:
Your friend says "Hey, did you hear this news story? A bookie in Vegas was attacked by one of his customers."
You say "Wow, I guess they were really at odds with each other. Baaahaha!"
You have just cracked a joke. A small, lame pun-based joke, to be sure, but still.
Your friend says "How many mice does it take to screw in a light bulb? Two, but how did they get into the lightbulb in the first place?"
Your friend has just told a joke.
According to the book A etymological dictionary of the Scottish language, published in 1887, it comes ultimately from the french word craquer (emphasis mine):
To CRACK, Crak, V. n. 1. To talk boastingly.]
Add, as sense 4. To talk idly, S.
"To crack," to boast, Norfolk; to converse, A.Bor. Fr. craquer signifies to boast. Signifie aussi dans le style familier, Mentir, habler, se vanter mal-a-propos et faussement. Diet. Trev. From what is mentioned by Mr. Pinkerton, it might seem to have been immediately borrowed from the French. Speaking of a famous tree in the neighbourhood of the Luxembourg at Paris, he says; " I believe this was the genuine tree of Cracovia, so called by a pun, not from the Polish town, but from the old word craquer, which signifies to gossip, as we say to crack jokes. For here the politicians used to assemble, and sit like so many destinies, spinning the thread of nations on wheels of rotten wood." Recollections of Paris, i. 182.