The quick answer--so they could get the engines back--has already been provided, but I'd like to offer some more historical context to that design decision.
Note that the shuttle as originally conceived didn't always drag useless engines into space. In fact, many of the original proposals were developed to be fully reusable, which meant there was no expendable ET, and the engines remained connected to their fuel tanks the whole time.
Some early shuttle proposals.
However, there's a fundamental problem here. The efficiency of hydrolox on the orbiter stage was virtually required if you wanted to have any meaningful payload (read: military satellites) on a reusable orbiter. However, the low density of hydrogen meant that the volume of tankage required would be very large. That by itself isn't a problem, except you've got to shield all that tankage during reentry.
The mass cost of the thermal protection system was quickly realized to balloon for a fully reusable shuttle. There were two ways around this: build a bigger booster, or not try to reuse your tankage. Pretty quickly, designers clued into the fact that this second route was the more affordable one...
For both companies, the point of departure lay in partially-reusable configurations that would carry their propellant in expendable tanks. This offered a route to lower development cost because the orbiter could shrink in size by carrying its propellant externally. The tanks could take form as simple aluminum shells, while the orbiter would have much less volume to enclose within its hot structures, and much less surface area to protect thermally. [...] Why was this approach so promising? Liquid hydrogen is bulky, having only one-fourteenth the density of water. Thus, although it makes up only about one-seventh of a shuttle's propellant load by weight, with six-sevenths being liquid oxygen, liquid hydrogen accounts for nearly three-fourths of the volume. Being low in density and hence light in weight, this fuel could be carried in external tanks of similar light weight. Being bulky, its removal would bring a welcome reduction in the vehicle size and surface area.
The developmental cost savings of this route were aggressively pushed by Northrup Grumman...
The use of external tankage cut the dry or unfueled weight of the complete two-stage shuttle by nearly one-third, from 1.02 million pounds to 692,000 pounds. In the words of the report, this weight saving "means structure we eliminate from design, do not provide tooling for, nor build, maintain, refurbish or otherwise pay for." [...] The peak funding level, \$1.85 billion, was a long way from the OMB requirement of \$1 billion. Nevertheless, it was \$350 million closer to this goal than the fully-reusable design. Moreover, in a brilliant example of having one's cake and eating it, Grumman proposed that the expendable tankage  would actually reduce the cost per flight. The tanks per se would cost \$740,000 per flight. Other savings, however, would more than offset this, with the largest of them stemming from a substantial cut in the amount of propellants for a flight, and from eliminating the need to refurbish the thermal protection of the now-simpler booster.
Eventually, people starting thinking about moving the LOX to external tankage also...
The next step was to lengthen this single external tank to allow it to carry liquid oxygen as well. This would reduce the size of the orbiter to a bare minimum. The tank, attached to the orbiter's belly, would demand structural strengthening, for its store of liquid oxygen would be quite heavy. With all propellant removed from the orbiter, that vehicle could achieve a standard design, independent of the tank. The tank could grow to a particularly large size, further lowering the staging velocity of the booster. In turn, this lower staging velocity would further reduce the size of the booster, cutting the cost of the Shuttle program anew.
After all this iteration, the shuttle we know was pretty much designed.
The new shuttle, sans boosters.
Source (and a very very good read): https://history.nasa.gov/SP-4221/contents.htm
All emphasis mine.