It depends on whether the adverb is acting on the object or the verb. In some cases, it doesn't matter. In other cases, it changes the meaning. Just for simplicity's sake, I'm going to replace the phrase "pretty much" with the adverb "almost".
Your example:
- "Lovely" and "wonderful" mean almost the same thing
- "Lovely" and "wonderful" almost mean the same thing
There are two words, and0 two meanings. In example 1, you are saying that the meanings are almost the same; in example 2, you are saying that the two words almost much have the same meaning. The resulting meaning to the listener is pretty much (!) the same
For a clearer difference, consider this example:
- He almost travelled right around the world.
- He travelled almost right around the world.
In example 1, because the adverb is acting on "him", it could mean the person never even set off on the journey! In example 2, the adverb is acting on the travelling, so it means that his travels took him almost right around the world, but not the whole way.