c.1300, "pile, heap, or group of things," from Old Norse stakkr "haystack" (cf. Danish stak, Swedish stack "heap, stack"), from Proto-Germanic *stakkoz, from PIE *stognos- (cf. Old Church Slavonic stogu "heap," Russian stog "haystack," Lithuanian stokas "pillar"), from root *steg- "pole, stick" (see stake (n.)). Meaning "set of shelves on which books are set out" is from 1879. Used of the chimneys of factories, locomotives, etc., since 1825.
To prearrange something dishonestly; assure one's advantage fraudulently; cold deck: I should have had the job, but they stacked the cards against me (1825+)