This is not an idiom. It is a particularly common instance of the general construction: "as X as Y", where both X and Y have a large range of possibilities. X can be an adjectival, an adverbial, or a quantifier determiner (much, little, many, few) and Y can a clauses or an ellipsis of a clause. The full clause for which "possible" is an ellipsis depends on the preceding verb. "He ate as much as possible" is an ellipsis for "He ate as much as it was possible for him to eat." When Y is a noun ("He ate as much as John."), the ellipsis is still for a clause ("He ate as much as John ate.").