It is true that the penalty function method is quite old (Richard Courant, “Variational methods for the solution of problems of equilibrium and vibrations”, 1943), but your success with using INFINITY, or even a large constant magic number, has more to do with the particular non-gradient-based algorithm you are using. The penalty method is traditionally a way of converting a differentiable constrained optimization problem into a differentiable unconstrained problem having the same solution(s).
Using INFINITY (or a large constant) for all infeasible points requires, at the very least, an optimization algorithm that can tolerate discontinuities.
Also, it must be easy to find feasible points (points that satisfy the constraints), as is indeed the case when using box constraints. The large “flat” region where the objective function is constant or INFINITY gives no hint where a feasible point might lie.
Finally, your non-gradient-based algorithm might get into trouble if it uses a point at INFINITY in a calculation to decide where to search next. You are fortunate that the algorithm you are using does not do this, or is well-implemented so that it handles overflows and INFINITIES gracefully. An algorithm such as Nelder-Mead (for example) might fail, even if your problem is otherwise smooth.