$x(a^3-y^3) +x^3(y-a)+ay(y^2-a^2)$
$=x(a-y)(a^2+ay+y^2) -x^3 (a-y)-ay(a-y)(a+y)$
$=(a-y)\bigg [xa^2 +axy+xy^2-x^3-a^2 y -ay^2 \bigg ]$
$=(a-y)\bigg [ (xa^2-a^2y) +(axy-ay^2) +(xy^2-x^3) \bigg ]$
$=(a-y) \bigg [a^2(x-y) +ay(x-y)-x(x-y)(x+y) \bigg ]$
$=(a-y)(x-y) \bigg [a^2+ay-x^2 -xy \bigg ]$
$=(a-y)(x-y)(a-x)(x+y+a)$