Inclusion is cofibration iff $(A\times I) \cup (X\times \{0\})$ is a retract of $X\times I$ Let $A\subset X$ be a subspace. Then the inclusion $i:A\to X$ is a cofibration iff $(A\times I) \cup (X\times \{0\})$ is a retract of $X\times I$.
I've proved the "$\implies$" direction.
“$\impliedby$“: Suppose that $H: X\times I \to Y =  (A\times I) \cup (X\times \{0\}$ is a retraction.
We want to show that $i:A\to X$ is a cofibration. It suffices to show that $i$ has the HEP w.r.t. the mapping cylinder $S(i) = \left( A\times I \sqcup X \right)/(a,0)\sim i(a)$. But $S(i)$ is precisely the space $Y$. So we want to verify that $i$ has the HEP w.r.t. $Y$.
Let $f:X\to Y$ be some map and $h:A\times I \to Y$ some homotopy such that $h_0 = f \circ i$. Our retraction $H$ might be a good candidate to fulfil the required conditions, namely that $H(x,0) = f(x)$ and $H(a,t) = h(a,t)$. Since $H$ restricts to the identity on $Y$, we require that $f(x) = (x,0)$ and $h(a,t) = (a,t)$. I don’t see why this requirement would be fulfilled.
What else can we do?
 A: Actually it suffices when the canonical maps $j_X:X\times\{0\}\hookrightarrow M_i$ and $\bar i:A\times I\to M_i$ extend to a map $r:X\times I\to M_i$ with $r(i(a),t)=(a,t)$ and $r(x,0)=x$. Because such $r$ would be  retraction (left-inverse) to the map $s:M_i\to X\times I$ sending $x$ to $(x,0)$ and $(a,t)$ to $(i(a),t)$. (Conversely, a retraction $r$ for $s$ would be an extension for the maps $j_X$ and $\bar i$). Then, if $f:X\times\{0\}\to Z$ and $G:A\times I\to Z$ are maps to any space $Z$ satisfying $G(a,0)=f(a,0)$, this induces a unique map $\tilde G:M_i\to Z$ such that $\tilde Gj_X=f$ and $\tilde G\bar i=G$. If we compose this to $H=\tilde Gr:X\times I\to Z$, we have $H(x,0)=f$ and $H(a,t)=G(a,t)$.
The problem is rather in the ambiguity regarding the topology on $M_i$. Since $r$ restricts to a continuous map $X\times\{0\}\cup A\times I\to M_i$ which is $j_X$ on $X\times\{0\}$ and $\bar i$ on $A\times I$, that means that the union of $j_X$ and $\bar i$ is continuous. This is not always the case, for example when $i$ is the inclusion $(0,1]\hookrightarrow[0,1]$, as the topology on the mapping cylinder of $i$ is in that case strictly finer than the subspace topology on $I\times\{0\}\cup(0,1]\times I$. However, if this subspace is a retract of $X\times I$, then one can show that both maps always combine to a continuous map. This is done in the appendix of Hatcher's Algebraic Topology (the proof first appeared 1968 as Lemma 3 in Strøm's Note on Cofibrations II).
