Why is the work output of any real machine less than the work needed to operate it?

work is gained due to friction
work is lost due to friction
friction reduces the work input