Pipelines perform a critical function in the petroleum business by transporting hydrocarbon commodities between oil fields, refineries, and consumer markets. We formulate an optimization problem for determining the optimal pumping modes and flow configuration for liquid pipeline operations. Based on requested flow rates and commodity prices submitted by users of the pipeline system, the system manager can solve an optimization problem to determine flow rates allocated to all customers, flows on each pipeline section, and pumps station operating settings in order to maximize economic value provided by a pipeline while adhering to limitations of pump machinery and the physics of fluid flow. In particular, the optimal solution will maximize the economic benefit for the pipeline transport network users and utilization of system capacity while also minimizing the energy expended in operation. This problem is nonconvex, and solutions are only guaranteed to be locally optimal. In this study we pose a mathematical optimization formulation with minimal modeling that captures the basic phenomena involved, and an algorithm based on general-purpose interior point optimization is proposed for efficient solution. We demonstrate our approach on a realistic case study based on a pipeline system in the United States.