\documentclass{article}
\usepackage{amsmath}
\mathchardef\breakingcomma=\mathcode`,
\newcommand{\allowbreakingcomma}{%
\begingroup\lccode`~=`,
\lowercase{\endgroup\def~}{\breakingcomma\penalty3000 }%
\mathcode`,="8000
}
\newcommand{\ml}[1]{%
\begingroup\allowbreakingcomma
#1%
\endgroup
}
\begin{document}
In this paragraph we have lists $\ml{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}$
and other lists $F(\ml{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z})$.
\end{document}