She was "irritated" by officers eating the snacks, according to an email sent by Clive Goodman, former royal editor at the now-defunct Sunday tabloid newspaper.
A memo was sent to palace officers, telling them to "keep their sticky fingers out", the Old Bailey heard.
In the email to former NotW editor Andy Coulson, which Mr Goodman had sent to himself, he wrote: "Problem is that police on patrol eat the lot... memo now gone around to all palace cops telling them to keep their sticky fingers out."
Prosecutor Andrew Edis QC told the jury the Queen was "upset" about the behaviour of the officers, according to Goodman's email.
"Apparently they were helping themselves to nuts," the barrister said. "They were all being scoffed by police. That irritated Her Majesty apparently."
In the email sent in March 2005, Goodman said he knew the printer doing the order of service for the Prince of Wales's wedding to the Duchess of Cornwall and had a man checking the wedding invitations, the jury heard.
"Only person to accept so far is Tony Blair," he wrote.
Goodman, 56, from Addlestone, Surrey, is charged with former spin doctor Coulson with conspiring to commit misconduct in public office.
Goodman and Coulson, 45, from Charing, Kent, face two allegations that they conspired together and with other unknown people to commit misconduct in public office between August 31 2002 and January 31 2003, and between January 31 2005 and June 3 2005.
Coulson is also accused of conspiring to hack phones between October 3 2000 and August 9 2006.
That charge is also faced by former NotW and Sun editor Rebekah Brooks, 45, of Churchill, Oxfordshire, and former managing editor Stuart Kuttner, 73, of Woodford Green, Essex.
Former News of the World news editor Ian Edmondson is "currently unfit" and will play no further part in the phone-hacking trial, the jury heard. The trial continues.