Make the piloncillo syrup: simmer the grated piloncillo, water, cinnamon stick, cloves and anise seed for 10 to 15 minutes until dissolved, strain through a fine-mesh sieve, and cool completely (about 30 minutes).
Whisk the flour, baking soda, baking powder, salt, ground cinnamon and ground ginger in a large bowl; rub in the softened butter and shortening until the mixture looks like coarse sand.
Pour in the cooled piloncillo syrup, 1 egg, the milk and the vanilla; stir, then knead briefly until a soft dough forms. Shape into a flat disc, wrap in plastic wrap, and chill for at least 1 hour.
Heat the oven to 350°F and line 2 baking sheets with parchment paper. Roll the chilled dough to 3/8 to 1/2 inch thick, cut pig shapes with a 5-inch cutter, place 2 inches apart, and chill the cut cookies on their sheets for 15 to 30 minutes.
Brush the pigs lightly with the beaten egg and bake at 350°F for 12 to 18 minutes, until lightly golden with small cracks on the surface.
Cool on the baking sheets for 5 minutes, then move to a wire rack to cool completely. Serve at room temperature with milk or coffee.