Linear and nonlinear ultraparabolic equations of Kolmogorov type arising in diffusion theory and in finance