In Blacklist, at the end of the episode "Pattie Sue Edwards" (season 5 episode 15), Patricia Sue Edwards received a American flag when her husband was buried with honor.
Why did the soldier slide 3 cartridges in it while handing it to her?
This is a common part of a miltary funeral
A standard part of any military funeral is the ceremonial shooting of three volleys in honor of the deceased. The three spent shell casings are presented to his or her next of kin.
BUT it is NOT a 21-gun salute, this is a common misconception. It's a 3-volley salute (Wikipedia) and can consist of 3, 5 or 7 firers.
Not a 21-Gun Salute
This funeral salute often is mistaken by people who aren't involved in the military as a 21-gun salute, although it is entirely different. The three volleys in the funeral salute are fired from rifles, not "guns."
In the military, a "gun" is actually a large-caliber weapon, such as a cannon. The 21-gun salute stems from naval tradition, and it is used to mark certain anniversaries, salute heads of state, and reigning royalty and honor national flags.
Battlefield Custom of Three Volleys
The tradition dates back to the European dynastic wars, which were between 1688 and 1748. The volleys were shots fired on the field during a battle, signaling a pause in the fighting. It was intended to allow time for both sides to remove the bodies of their fallen soldiers from the battlefield.
Service Members Needed for Three Volleys
The firing team in this ceremony can consist of any number of service members, but one usually sees a team of eight, with a non-commissioned officer (NCO) in charge of the firing detail. Whether the team consists of three, eight, or 10 service members, each member fires three times.
Three Bullet Casings Slipped Into Folded Flag
The military funeral honors also include a ceremony in which the honor guard removes the flag from the casket and carefully folds it, with the blue field of stars facing up. Then, the folded flag is presented to the deceased person's family as a token of gratitude for that person's service.
The flag detail often slips three shell casings into the folded flag before presenting the flag to the family. Each casing represents one volley. This gesture provides a slightly different meaning for the symbolism of the three bullets in a military funeral.
A soldier that is buried with honors recieves a 21 gun salute. Today, that would be comprised of 7 soldiers firing their guns 3 times. (7x3) So the 3 cartridges would be from that context.