In this article an approach to incorporate a flexible cost functions framework into the cost-optimal design of heat exchanger networks (HENs) is presented. This framework allows the definition of different cost functions for each connection of heat source and sink independent of process stream or utility stream. Therefore, it is possible to use match-based individual factors to account for different fluid properties and resulting engineering costs. Layout-based factors for piping and pumping costs play an important role here as cost driver. The optimization of the resulting complex mixed integer nonlinear programming (MINLP) problem is solved with a genetic algorithm coupled with deterministic local optimization techniques. In order to show the functionality of the chosen approach one well studied HEN synthesis example from literature for direct heat integration is studied with standard cost functions and also considering additional piping costs. Another example is presented which incorporates indirect heat integration and related pumping and piping costs. The versatile applicability of the chosen approach is shown. The results represent designs with lower total annual costs (TAC) compared to literature.