This appeared in the southern states of the USA about the middle of the nineteenth century. It was used by tradespeople in New Orleans for a small extra item or bonus that they gave to their most favoured customers.
The best early description of the word was written by Mark Twain, in his book Life on the Mississippi of 1883:
We picked up one excellent word — a word worth traveling to New Orleans to get; a nice limber, expressive, handy word — “lagniappe”. They pronounce it lanny-yap. ... The custom originated in the Spanish quarter of the city. When a child or a servant buys something in a shop — or even the mayor or the governor, for aught I know — he finishes the operation by saying “Give me something for lagniappe”. The shopman always responds; gives the child a bit of licorice-root, gives the servant a cheap cigar or a spool of thread, gives the governor — I don’t know what he gives the governor; support, likely.
Despite its Italian look, lagniappe is actually a modified form of a Louisiana French creole term that derives from the New-World Spanish la ñapa, a gift, which in turn has its origin in a Quechua word yapa for a gift or tip.