Just to expand on this -- they don't quite have the same implication in terms of length. "Long ago" sounds longer than "a long time ago." For example, 'he died long ago" is usually used for someone that died centuries ago. "He died a long time ago" might be used for someone centuries ago, but also for someone that died several years ago.
e.g.: "My grandpa died long ago" sounds strange; "my grandpa died a long time ago" sounds more natural.