In this paper, the compound Poisson risk model with surplus-dependent premium rate is analyzed in the taxation system proposed by Albrecher and Hipp (Blätter der DGVFM 28(1): [13][14][15][16][17][18][19][20][21][22][23][24][25][26][27][28] 2007). In the compound Poisson risk model, Albrecher and Hipp (Blätter der DGVFM 28(1): [13][14][15][16][17][18][19][20][21][22][23][24][25][26][27][28] 2007) showed that a simple relationship between the ruin probabilities in the risk model with and without tax exists. This so-called tax identity was later generalized to a surplus-dependent tax rate by Albrecher et al. (Insur Math Econ 44(2):304-306, 2009). The present paper further generalizes these results to the Gerber-Shiu function with a generalized penalty function involving the maximum surplus prior to ruin. We show that this generalized Gerber-Shiu function in the risk model with tax is closely related to the 'original' Gerber-Shiu function in the risk model without tax defined in a dividend barrier framework. The moments of the discounted tax payments before ruin and the optimal threshold level for the tax authority to start collecting tax payments are also examined.