In a medium pot, bring the water to a boil over medium heat. Once it boils, reduce the heat to medium-low and add the grated piloncillo, cinnamon stick, clove, star anise, and orange peel if using. Stir well to dissolve the piloncillo fully into the water.
Lower the heat, then add the ground coffee, stirring gently. Allow the mixture to simmer for 5 minutes, being careful not to let it boil, as that can make the coffee bitter.
After simmering, remove the pot from the heat and let it sit briefly to allow the grounds to settle, then stir in the coffee liqueur if using.
Strain the coffee through a fine mesh strainer into a shallow bowl and set aside to cool to room temperature.