Policies differ depending on the potential source.
You generally may not accept gifts from sources outside the government that are given because of your official positions or that come from certain interested sources (“prohibited sources”). Prohibited sources include persons (or an organization made up of such persons) who are seeking official action by, are doing business or seeking to do business with, or are regulated by your agency; or have interests that may be substantially affected by performance or nonperformance of your official duties.
Also, you generally may not give a gift to an official superior nor can you accept a gift from another employee who receives less pay.
There are exceptions to each, including situations involving gifts of minimal value and items given to those at widely attended events. For details, see Chapter 10, Section 5 of the Federal Employees Almanac.