Found small lump below inside of ankle. Painful to walk and hurts during rest. Doc ordered MRI to rule out tpd or mass. Could I end up in a cast?

Depends on results. Depends on the results of mri. With tibialis posterior dysfunction, immobilization may not be enough, surgery may be necessary and then casting. Plus there will be a need to address the flat footed ness. If a mass consistent with a ganglion, have it drained as an in office service. Ask if they can remove it, as an in office service if not successful. If other mass, have removed.