As far as most grammar books state, one of the differences between despite and though is that despite can be used with a gerund, while though goes with a sentence, an adjective, an adverb, a past participle.

So, can we use though with a gerund, like "though living in distant cities, ..."?

P.S: I have googled and seen I can. But books don't say so.
The clause sounds awkward at best, though I can imagine its appearance in a google search. It is a simple difference which I am sure your grammar book states: 'despite' is a preposition, while 'though' is a conjunction or adverb. The former take noun objects, while the latter do not.

If it were more clearly a participle-- 'Though they are living in distant cities, the family members still keep in touch via email'-- then all would be well.
May I offer my two cents?

As MM explained, 'despite' is a preposition, while 'though' is a cojunction.
The nature inherent in these two is different. How different?

Despite + Noun
Though + clause

Though it rained yesterday, we went on a field trip.
Despite the rain yesterday, we went on a field trip.

You cannot say either of these.

Despite it rained yesterday, ....( x )
Though the rain yesterday, ....( x )

Now let's look at the "despite/though " form.

The [Ving] in both looks exactly the same in form per se, but again the nature is different.

The [Ving] here is a gerund which is considered a noun. As it is a noun, it can be preceded or modified by possessives or adjectives, or both. (I can't think of any examples without a modifier at the moment. If any, let me know, please.)

Despite her jogging for an hour everyday, her cholestrol level remained the same.

The [Ving] is a participle, more specifically a present participle.
This [Ving] is a remnant resulting from the omission of from the "though" clause.
The can be omitted from such structures as
Though (S + be) Ving..., S V.... (Note the two S's must be the same.)
Though (S + be) p.p...., S V.... (ditto)
Though (S + be) adj...., S V.... (ditto)
(Note the omission is optional.)

Though (he was) driving slowly, he couldn't stop in time to avoid the accident.
Though (he was) stranded in the ravine, he didn't lose hope.
Though (he was) small, he took on the challenge of his heavy-set neighbor.

You cannot say or write:
Though his driving slowly, he couldn't ....( x )