A Hamiltonian formulation of generic many-particle systems with space-dependent balanced loss and gain coefficients is presented. It is shown that the balancing of loss and gain necessarily occurs in a pair-wise fashion. Further, using a suitable choice of co-ordinates, the Hamiltonian can always be reformulated as a many-particle system in the background of a pseudo-Euclidean metric and subjected to an analogous inhomogeneous magnetic field with a functional form that is identical with space-dependent loss/gain co-efficient.The resulting equations of motion from the Hamiltonian are a system of coupled Liénard-type differential equations. Partially integrable systems are obtained for two distinct cases, namely, systems with (i) translational symmetry or (ii) rotational invariance in a pseudo-Euclidean space. A total number of m+1 integrals of motion are constructed for a system of 2m particles, which are in involution, implying that two-particle systems are completely integrable. A few exact solutions for both the cases are presented for specific choices of the potential and spacedependent gain/loss co-efficients, which include periodic stable solutions. Quantization of the system is discussed with the construction of the integrals of motion for specific choices of the potential and gain-loss coefficients. A few quasi-exactly solvable models admitting bound states in appropriate Stoke wedges are presented.