So I heard that like others have said that it is a segulah to eat from a pidyon haben. The reason specifically garlic and sugar cubes is because back in the Heim a pidyon haben was rare and everyone wanted a piece of it. So someone would go and eat there and bring home leftovers for others. But after a long journey back home to the shtetel, the food would spoil. So they gave out sugar and garlic which doesn’t spoil very quickly.