Words that are spelled the same but have different meanings, and sometimes different pronunciations, are called homographs. Poets may use them for wordplay, surprise, or layered meaning, especially when a line can be read in more than one way.
Some homographs are also homophones or homonyms, but the key feature here is shared spelling.
Example
The dove will dove beneath the wave
and leave the shore unsaid.
Here, dove can mean a bird, and dove can mean plunged.
[n] two words are homographs if they are spelled the same way but differ in meaning (e.g. fair)