Since some people take sense 2 to be the opposite of sense 1, it has been frequently criticized as a misuse. Instead, the use is pure hyperbole intended to gain emphasis, but it often appears in contexts where no additional emphasis is necessary.
Many words can be used both literally and figuratively.
He took her comments literally.
He's a sailor who knows his ropes, literally and figuratively.
The term “Mardi Gras”literally means “Fat Tuesday” in French.
The story he told was basically true, even if it wasn't literally true.
… make the whole scene literally glow with the fires of his imagination. —Alfred Kazin, Harper's, December 1968
Even Muff did not miss our periods of companionship, because about that time she grew up and started having literally millions of kittens. —Jean Stafford, Bad Characters, 1954
Lily, the caretaker's daughter, was literally run off her feet. Hardly had she brought one gentleman into the little pantry … than the wheezy hall-door bell clanged again and she had to scamper along the bare hallway to let in another guest. —James Joyce, Dubliners, 1914
… yet the wretch, absorbed in his victuals, and naturally of an unutterable dullness, did not make a single remark during dinner, whereas I literally blazed with wit. —William Makepeace Thackeray, Punch, 30 Oct. 1847