In the case of SpaceX they are more efficient because NASA is intentionally hamstrung relative to them, this is done by congress because they treat NASA as a jobs program, it is intended to provide employment in as many states as possible, not produce efficient and affordable rockets. Congress dictates which rockets they are allowed to build, where they will build them, who will build them, and overrides them, forcing them to build nonsense rockets such as SLS.