No machine can operate at 100 percent efficiency because some of the energy input will always be used to overcome the force of gravity and the effects of friction and air resistance. Even an optimally tuned engine heats up eventually, and that heat is thermal energy being lost.
No machine is free of the effects of gravity, and even with lubrication, friction is always present, so the energy a machine produces is always going to be less than the energy put into it. Most machines involve transferring energy from one place or another, or transforming one form to energy into another, but machines cannot create energy. This tendency of systems to lose energy is called entropy. Entropy in a closed system never decreases. Systems always tend toward a state of increasing disorder unless more energy is put in to the system to counteract this tendency.
A machine that can keep running without the input of energy is called a perpetual energy machine. Inventors have long sought to develop such a machine but there is near universal consensus among scientists that perpetual motion is impossible because it violates the laws of thermodynamics. But even if a perpetual motion machine could be developed, it would never do better than breaking even. It could not create more energy than it used.