Solid or liquid
TSA’s entry for solid chocolate says solid food “can be transported in either your carry-on or checked bags.” Its entry for liquid chocolate is a yes in a carry-on only at 3.4 ounces or less, and a yes in a checked bag.
Bars and a box of truffles are solid. A bottle of chocolate sauce is not. A chocolate spread follows the same rule as peanut butter: TSA’s travel tips put anything you can spread over 3.4 ounces in a checked bag.
At the checkpoint
TSA says officers “may instruct travelers to separate items from carry-on bags such as foods, powders” and anything else that clutters the X-ray image. A box of chocolates in the top of a bag comes out and goes back in without fuss.
As a gift
TSA’s advice for gifts is a gift bag or a box with a lid, so an officer can look inside “and avoid the possibility of opening fully wrapped presents.” A boxed chocolate gift with the lid loose does that. There’s more in food gifts and wrapped gifts.
Flying home from abroad
TSA’s answer covers screening at US airports. On the way home you go through the other airport’s screening first, and its rules are the ones that count there.
Coming home through US customs
There’s no customs answer for chocolate. CBP’s page on prohibited items says “You may bring bakery items and certain cheeses into the United States,” but doesn’t name chocolate, and CBP’s agriculture page doesn’t either. USDA doesn’t list it on its traveler pages.
Declare it either way. USDA says declared food brings no penalty, even when it’s refused. What happens if you don’t.

TSA puts this on every entry: “The final decision rests with the TSA officer on whether an item is allowed through the checkpoint.”