It becomes a literal hammer in the sense that it is an object that drives a nail into wood.
That’s the definition of a hammer, regardless of its shape or appearance. Anything that is used for this purpose is a hammer. It’s a hammer in substance. In the philosophical use of the term “substance” not the scientific.
But still not a hammer. If someone asks you for a hammer, don’t hand them a screwdriver instead of a hammer. Using it as a hammer doesn’t change it into a hammer.