See, the thing is, technically speaking, literal schmiteral.
We use the word “literal”, but what does it mean? Does it mean that there’s a one to one absolute correspondence between the word and the thing?
“God gave names to all the animals”* Okay, so that one is a cat. Fine. But what about that other one? Is that a cat, too? Sure, why not! Is this one a cat? Okay, fine, that one too. What about this:
It’s a cat o’ nine tails: but is it a cat?
The point is that language is built up from metaphors, from the ground up. Even a neanderthal grunt is a kind of metaphor: “Uggh!” means “Heck, this bison tastes good!” but “Ahhh!” means “Sabre-tooth, run!” They’re just one thing that points to another thing, which is really all a metaphor is.
So what do we mean when we speak of literal and metaphorical usages? We’re talking about shades on a spectrum, not absolute differences. The same text can have both literal and metaphorical senses; this is, in fact, the primary conceit of most poetry.
But we must be careful not to erase the difference. When we speak of “dark” and “light”, it’s never absolute dark or absolute light. As intelligent and reflective people, we can live in a world without absolutes. But our philosophical sophistication doesn’t save us from bumping into things at night! The distinction is meaningful and relevant, it’s just not absolute.
Now, when it comes to the suttas, they are typically fairly clear and explicit when it comes to such matters. Similes are formally introduced as such. Poetic conceits, narrative play, and other non-literal forms are usually easy to identify. When it comes to doctrinal passages, on the whole it is clear they were meant literally. But nuance and context are everything, especially when reading an ancient sacred literature.
* According to Bob Dylan. The Bible says it was Adam who did the naming. But I’ve always found Bob to be more reliable than the Bible!