You sure can, as long as you haven't either used bleach to get them out of the ground, or have applied any kind of fertilizer.
I got a batch of earthworms from the bait/takle store, and have grown my own culture in a 10 gl tank, with soil, leaves and food scrapes on top. At first I hated cutting apart those wiggly things, but I have gotten used to it.