Is it possible with TileMills and CartoCSS?
Yes, it is. This rendering is common for contour lines. See this blog entry for CartoCSS code.
I should warn you that when using this code (specifically,
text-comp-op operation), you won't be able to export your map in a vector format: SVG and PDF output would produce a raster image in a vector container. You might not need it though.