A bed made apple-pye fashion, like what is called a turnover apple-pye, where the sheets are so doubled as to prevent any one from getting at his length between them: a common trick played by frolicsome country lasses on their sweethearts, male relations, or visitors.
Definition taken from The 1811 Dictionary of the Vulgar Tongue, originally by Francis Grose.
Apple Dumplin Shop * April FoolNathan Bailey's 1736 Dictionary of canting and thieving slang
John S. Farmer's collection of canting songs and slang rhymes