The optimization of taxation and profit maximization constitute two fundamental and interconnected problems, inherently entwined as firms navigate within a given tax framework. Nonetheless, existing literature commonly treats these problems separately, focusing either on optimal taxation or on profit maximization independently. This paper endeavors to unify these problems by formulating a bilevel model wherein the government assumes the role of a leader, and the profit-maximizing monopolist acts as a follower. The model assumes technology given by a constant elasticity of substitution (CES) production function, with market prices following a linear demand curve. Since the solution for a general case with an arbitrary degree of homogeneity cannot be determined explicitly, analytical expressions for the tax revenue function, profit function, optimal tax rates, and optimal input levels are derived for scenarios with degrees of homogeneity set to values 0.5 for decreasing and 1 for constant returns to scale. Several illustrative numerical examples are presented alongside corresponding graphical representations. The last example, with a degree of homogeneity set to value 2, shows that the optimal solution is achievable under monopolist assumption even with increasing returns to scale, a scenario impossible under perfect competition. The paper ends with discussions on sensitivity analysis of the change in the optimal solution with regard to the change in the producer's price.