A lawn mower spitting oil can be caused by oil getting into the exhaust or carburetor when you tip it on it's side or it could be that you overfilled the oil level.
If you've tipped the lawn mower over on it's side then it could be simply that oil has traveled from the engine and into the carburetor intake and exhaust system and when the oil clears it should no longer spit oil.
If you haven't tipped the engine on it's side then the oil could be too full so check the oil level and if it's too full then drain some of it down.
On a push lawn mower there should be a drain plug underneath the lawn mower.
If your lawn mower has an oil filter it could be that the oil filter has become clogged and needs replaced.
If none of that is the problem then you might have blown piston rings or something else internally is going on.
Most times though the lawn mowers that spit oil are just because the lawn mowers engine has too much oil in it.