As other uses have pointed out, your example is unusual in that is does not include any time value or volatility value in the quoted premiums, the premiums you quote are only intrinsic values. For well in-the-money options, the intrinsic value will certainly be the vast majority of the premium, but not the sole component.
Having said that, the answer would clearly be that the buyer should buy the $40 call at a premium of $10. The reason is that the buyer will pay less for the option and therefore risk less money, or buy more options for the same amount of money. Since the buyer is assuming that the price will rise, the return that will be realised will be the same in gross terms, but higher in relative terms for the buyer of the $40 call.
For example, if the underlying price goes to $60, then the buyer of the $40 call would (potentially) double their money when the premium goes from $10 to $20, while the buyer of the $30 call would realise a (potential) 50% profit when the premium goes from $20 to $30.
Considering the situation beyond your scenario, things are more difficult if the bet goes wrong. If the underlying prices expires at under $40, then the buyer of the $40 call will be better off in gross terms but may be worse off in relative terms (if it expires above $30). If the underlying price expires between $40 and $50, then the buy of the $30 will be better off in relative term, having lost a smaller percentage of their money.