There are different types of mimic.
According to The Ecology of the Mimic (Dragon #75):
The mimic is a curious (and dangerous) creature to most minds – but few know, or care to know, that there are actually several related species of mimic, divided into two groups: a larger, "killer" variety that is of lesser intelligence, attacking all nearby prey, and does not speak; and the more intelligentt, eloquent species which will often bargain for food ...
Hence according to this article, many mimics are of the well-known variety which simply disguise as a chest or other item and hope to kill and eat adventurers, but there is another sort, generally smaller and weaker, who will rather bargain for food or safety.
AD&D's Monster Manual describes it thusly:
There are two varieties of this creature, the large (9-10 dice), semi-intelligent carnivorous "killer mimic" and the slightly smaller, intelligent sort. While the former will attack anything which is nearby, the latter are generally friendly if offered food. ... The killer mimics do not speak, but the other breeds have their own language and can usually speak several other tongues such as common, orcish, etc. For consideration they will usually tell a party about what they have seen nearby.
D&D 3.5's Monster Manual (p. 186) concurs that a mimic will not always simply kill adventurers if it can get a better deal using threats or trickery:
A mimic often surprises an unsuspecting adventurer, lashing out with a heavy pseudopod. The creature does not necessarily fight to the death if it can succeed in extorting treasure or food from a party.